-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix schema type of AsyncAPI operation tags #1339
Conversation
🦋 Changeset detectedLatest commit: 6f2a72d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The tests are here: https://github.com/Redocly/redocly-cli/tree/main/__tests__/lint/async2 - but they're really just the examples supplied by the AsyncAPI project to make sure we're not breaking anything. Tags do not work the same way in OpenAPI (where they are defined at the top level and then used in the operations) and in AsyncAPI (where they are more freeform within each operation or trait), which is why the objects aren't re-used. Could you say something about your use case and if you saw a problem with the AsyncAPI linting? |
Yes, I tried to lint a valid AsyncAPI spec and got a bunch of errors like this:
The AsyncAPI spec I linked in the PR doesn't separate tag definition and usage. An example of an operation with tags from the spec is as follows: operationId: registerUser
summary: Action to sign a user up.
description: A longer description
security:
- petstore_auth:
- write:pets
- read:pets
tags:
- name: user
- name: signup
- name: register
message:
headers:
type: object
properties:
applicationInstanceId:
description: Unique identifier for a given instance of the publishing application
type: string
payload:
type: object
properties:
user:
$ref: "#/components/schemas/userCreate"
signup:
$ref: "#/components/schemas/signup"
bindings:
amqp:
ack: false
traits:
- $ref: "#/components/operationTraits/kafka" |
I've added a test that passes with this change, but fails if the change is reverted. |
a05db39
to
6f2a72d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for the pull request, the explanation and the test. It took us a while to verify, so thanks for your patience!
What/Why/How?
Tags type on operation and operation trait wasn't using available TagList type that other elements used.
Reference
https://www.asyncapi.com/docs/reference/specification/v2.6.0#tagObject
Testing
Added an example of operation with tags for linting.
Screenshots (optional)
N/A
Check yourself
Security