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

additionalProperties: true #589

Closed
thushalya opened this issue Mar 21, 2023 · 5 comments
Closed

additionalProperties: true #589

thushalya opened this issue Mar 21, 2023 · 5 comments

Comments

@thushalya
Copy link
Contributor

thushalya commented Mar 21, 2023

Since additionalProperties variable is using AsyncApiSchema type , cannot give the value as true when it comes to create schema for

map<json>

Here json will be dynamic. Isn't it good to have it as the type of Object in java.. Or is there any way to set this please point out to me . Thank you

@EricWittmann
Copy link
Member

Hi @thushalya - unlike OpenAPI, the AsyncAPI specification actually does not allow boolean values for additionalProperties of an asyncapi schema. From the AsyncAPI spec:

image

If you follow the link they include in that section to the additionalProperties section of the JSON Schema Validation spec, you will find this:

image

My reading of this is that the current modeling in Apicurio Data Models v2 is correct.

@thushalya
Copy link
Contributor Author

thushalya commented Mar 27, 2023

Hello @EricWittmann can you refer to this issue asyncapi/jasyncapi#131 in jasyncapi
and also it says JSON Schema MUST be an object or a boolean in here also.
https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-01#section-4.3.1
image

They have already changed it in jasyncapi latest model

@EricWittmann
Copy link
Member

Ah ha - that's a subtlety of the JSON schema spec I didn't realize, namely that true and false are actually VALID JSON SCHEMAS!

My mind is blown.

It's easy enough to fix, fortunately. Do you want to give it a shot or wait for me? :) All you would need to do is change the descriptions in the spec yaml files. For example, this must be changed:

https://github.com/Apicurio/apicurio-data-models/blob/main/src/main/resources/specs/asyncapi/asyncapi-2.0.yaml#L554-L555

And should become this:

https://github.com/Apicurio/apicurio-data-models/blob/main/src/main/resources/specs/openapi/openapi-3.0.yaml#L507-L508

Then rebuild and see if anything breaks.

Note: you would need to make the above change in all of the AsyncAPI yaml files.

@thushalya
Copy link
Contributor Author

thushalya commented Mar 29, 2023

@EricWittmann Yeah definitely I will do it.

@EricWittmann
Copy link
Member

Fixed in #595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants