Apicurio/apicurio-data-models

additionalProperties: true

Closed this issue · 5 comments

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

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.

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

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.

@EricWittmann Yeah definitely I will do it.

Fixed in #595