You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an extension to #772 instead of not validating non default schema format examples. the parser should validate that the example is valid w.r.t to the schema regardless of format. This gives increased confidence that the complete document is valid.
Description
To do this a new rule will have to be introduced which like the src/schema-parser/spectral-rule-v2.ts rule will take in the parser instance. This will be used to parse the schema in the provided format to the default format, which can then be used to validate the examples against the schema.
The old rule can renamed to something like asyncapi2-message-examples-default and the new rule would be asyncapi2-message-examples like the asyncapi2-schemas rule and equivalent asyncapi2-schemas-default rule there at the moment.
This would be a breaking change for anyone that had an invalid example for a schema provided with the non default schema format. However it was only possible to do that after #772 was completed, so it is unlikely there will be any people in this situtation at the moment.
I have code ready for this that can be reviewed alongside the issue. It didn't take that long so I won't be at all bothered if the decision is not do this feature
The text was updated successfully, but these errors were encountered:
@jonaslagoni I have raised this extension feature request as discussed
I can create a PR for this feature now or wait for discussion on whether to do it
Feel free to create the PR @chrispatmore, if you can just add the new spectral rules for non-default schema formats, we can always create an issue for when we want to include them in a major version.
Reason/Context
As an extension to #772 instead of not validating non default schema format examples. the parser should validate that the example is valid w.r.t to the schema regardless of format. This gives increased confidence that the complete document is valid.
Description
To do this a new rule will have to be introduced which like the
src/schema-parser/spectral-rule-v2.ts
rule will take in the parser instance. This will be used to parse the schema in the provided format to the default format, which can then be used to validate the examples against the schema.The old rule can renamed to something like
asyncapi2-message-examples-default
and the new rule would beasyncapi2-message-examples
like theasyncapi2-schemas
rule and equivalentasyncapi2-schemas-default
rule there at the moment.This would be a breaking change for anyone that had an invalid example for a schema provided with the non default schema format. However it was only possible to do that after #772 was completed, so it is unlikely there will be any people in this situtation at the moment.
I have code ready for this that can be reviewed alongside the issue. It didn't take that long so I won't be at all bothered if the decision is not do this feature
The text was updated successfully, but these errors were encountered: