Repository navigation
feat: json schemas for bindings - #60
Conversation
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
|
@KhudaDad414 Thanks for handling this task! I know that it's draft, but I advise you to keep the schemas in some folder, e.g. |
thanks for the input. I will put them inside a folder. any other advice regarding schema? |
|
I think we need this https://github.com/asyncapi/asyncapi-node/blob/master/schemas/2.0.0.json#L10-L15 on every schema file to make sure no additional props are added, but extensions (props with @fmvilas on bindings you can find sentences that only props from given list are allowed but I guess we still want to have specific bindings extendable, right? |
magicmatatjahu
left a comment
There was a problem hiding this comment.
@KhudaDad414 I added some comments :) Good progress!
specificationExtension support added.
|
@derberg @magicmatatjahu The schemas are completed. |
|
I suggest to:
|
|
I agree with @GeraldLoeffler with all except the One more comment from my side: @rcoppen would you like to review schemas provided for IBMMQ? |
|
fwiw, here is the section from my work-in-progress bindings specification that argues for |
|
@GeraldLoeffler I looked at it and
This is exactly the purpose of extensions.
this is somehow valid, but did you consider that someone can add a property that means "A" and with the next binding version we add another property like that, but with a different meaning, "B"? and it can lead to a problem. This is why extensions are always with prefix |
derberg
left a comment
There was a problem hiding this comment.
Oh man this was a tremendous effort from your side, hats off 🙇🏼
Sorry for delayed review but I had some bank holidays here in Poland.
I left few comments, sorry but mainly to improve schemas. I did amqp, http and ibmmq only as I noticed that things that needs improvement are mostly around the same, oneOf or default
Also please add description property and example property to all the properties from all the schemas. On the other hand it is not a hard requirement for me for a 1st version, you can do it in another PR if you do not want to overcomplicate this one.
For next review round, please, when you push fixes, don't do it randomly or in one huge commit. Would be awesome if you could do commit per fix. I mean, when you remove "default": "latest" from all the bindingVersion, then just do this change in all files and push as single commit. And then the rest
|
one more thing, for $id I think it is better to do |
|
@derberg Thanks for the review. I think I made all of the requested changes. |
derberg
left a comment
There was a problem hiding this comment.
I'm afraid you need to look again into those oneOf. They seem to not work, I tried some online schema validation, to validate example from binding with schema, first from the like, amqp and there were errors related to oneOf.
We use AJV validator in the parser, so best would be to test those schemas against official bindings examples.
also, what about my comment about descriptions and examples?
last but not least -> for bindingVersion I think we need const pointing to the versions number`
Let me know if you need some help with oneOf. I recommend trying a combination of oneOf and allOff, I tried your current approach once and then skipped to use oneOf with allOf
|
@derberg thanks again for the review. I hope I am not wasting too much of your valuable time on this PR but I wanted to ask which website are you using, I'm using https://www.jsonschemavalidator.net/ and it is validating perfectly. |
|
@KhudaDad414 yup, I was using https://www.jsonschemavalidator.net/ and yeah, I see it works now 🤔 I must have done something wrong judging to quickly, sorry 🙏🏼
yeap, have a look at asyncapi spec for example https://github.com/asyncapi/asyncapi-node/blob/master/schemas/2.0.0.json#L17-L22 |
|
sorry, wrong button 😅 |
|
@derberg A review would be appreciated :) |
|
@KhudaDad414 Related to oneOf and "oneOf": [
{
"properties": {
"is": { "const": "routingKey" },
"queue": false
},
"required": [
"exchange"
]
},
{
"properties": {
"is": { "const": "queue" },
"exchange": false
},
"required": [
"queue"
]
}
],But using |
Thanks, didn't know that.🙂 |
derberg
left a comment
There was a problem hiding this comment.
@KhudaDad414 this is looking great now. This is a gigantic effort you did here! like seriously 🚀
once we merge, we need to think on the next step, how to integrate it with asyncapi-node repo
Description
Related issue(s)
See also #507