-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: add core message payload validation #334
feat: add core message payload validation #334
Conversation
Kudos, SonarCloud Quality Gate passed! |
"application/vnd.aai.asyncapi;version=2.0.0", | ||
"application/vnd.aai.asyncapi+json;version=2.0.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.0.0", | ||
"application/vnd.aai.asyncapi;version=2.1.0", | ||
"application/vnd.aai.asyncapi+json;version=2.1.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.1.0", | ||
"application/vnd.aai.asyncapi;version=2.2.0", | ||
"application/vnd.aai.asyncapi+json;version=2.2.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.2.0", | ||
"application/vnd.aai.asyncapi;version=2.3.0", | ||
"application/vnd.aai.asyncapi+json;version=2.3.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.3.0", | ||
"application/vnd.aai.asyncapi;version=2.4.0", | ||
"application/vnd.aai.asyncapi+json;version=2.4.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.4.0", | ||
"application/vnd.aai.asyncapi;version=2.5.0", | ||
"application/vnd.aai.asyncapi+json;version=2.5.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.5.0", | ||
"application/vnd.aai.asyncapi;version=2.6.0", | ||
"application/vnd.aai.asyncapi+json;version=2.6.0", | ||
"application/vnd.aai.asyncapi+yaml;version=2.6.0", |
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.
Because there are no changes to the schema across all v2 versions and v3, I guess it makes sense to validate it against these, right?
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.
I'd say it does make sense. Better to be explicit ;]
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.
I'm concerned about having to maintain this list, add new elements per version, etc.
Can we use a pattern instead of enum here?
{
"type": "string",
"pattern": "^application\\/vnd\\.aai\\.asyncapi(\\+json|\\+yaml)?;version=\\d+\\.\\d+\\.\\d+$"
}
Maybe some change is needed. You can test it in https://www.jsonschemavalidator.net/s/VTaBCoGr
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.
Pretty sure we dont want to enable v1 or future v4 schemas here right? 🤔
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.
Also would we not want to explicitly state which schema formats are allowed as values? Using something like v2.69.0
would not give a validation error with regex 🤔
Unless you explicitly add a range, but then you are back to having to change this each version anyway.
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.
Good point.
Also thinking about new features being added between versions (no breaking changes). For example, let's say 3.1.0
introduces a new field in the schema so you will have to do a split, serving one schema for >=2.x <=3.0, and another for 3.1.
Porting this to the pattern will be a bit messy. I don't like to maintain all this list but indeed i can't find a better alternative ATM but automating somehow this (we can think about in near future).
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.
I'm suggesting to use a pattern instead of enum here https://github.com/asyncapi/spec-json-schemas/pull/334/files#r1133772134
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.
LGTM!
/rtm |
🎉 This PR is included in version 5.0.0-next-major-spec.14 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 6.0.0-next-major-spec.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR enables the following:
Fixes #166
Blocked by #333