Skip to content
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

AsyncAPI rule to validate property example in schema #1732

Closed
Tracked by #2100
aleung opened this issue Jul 8, 2021 · 2 comments
Closed
Tracked by #2100

AsyncAPI rule to validate property example in schema #1732

aleung opened this issue Jul 8, 2021 · 2 comments
Labels
AsyncAPI Issues related to the AsyncAPI ruleset enhancement New feature or request

Comments

@aleung
Copy link

aleung commented Jul 8, 2021

User story.
As a API designer, I can run spectral to check my AsyncAPI, so that I can find out invalid property example in schema.

Describe the solution you'd like
Current Spectral AsyncAPI ruleset has a asyncapi-schema-examples rule to validate examples under a schema. However it doesn't check the example of a property. I'd expect there is an AsyncAPI rule that is equivalent to OAS rule oas3-valid-example.

Additional context
Below is an AsyncAPI snippet with invalid example:

components:
  schemas:
    id:
      type: integer
      example: "123456"
@P0lip P0lip added AsyncAPI Issues related to the AsyncAPI ruleset enhancement New feature or request labels Aug 30, 2021
@magicmatatjahu
Copy link
Contributor

@aleung Hi! I don't think this issue is still valid, because AsyncAPI 2.x.x never supported the example field in Schema Object (documentation https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#properties). AsyncAPI Schema Object has only examples field, which is currently being validated - https://github.com/stoplightio/spectral/blob/develop/docs/reference/asyncapi-rules.md#asyncapi-schema-examples

@aleung
Copy link
Author

aleung commented Mar 24, 2022

@magicmatatjahu Thank for the clarification. I checked the specification and indeed the schema object singular example was an OpenAPI-specific keyword.

@aleung aleung closed this as completed Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AsyncAPI Issues related to the AsyncAPI ruleset enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants