Details
-
Task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
JSON schema requires `additionalProperties: false` to be specified to prohibit additional properties those are not explicitly defined in `properties`
https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties
And it doesn't propagate to the children, i.e. `additionalProperties: false` needs to be specified on each object definition.
Since camel-yaml-dsl/generate-yaml-schema mojo doesn't add this property at this moment, the generated schema doesn't really restrict properties. We want to add an option 'additionalProperties" on generate-yaml-schema mojo, and if it's false, add `additionalProperties: false` on each objects in generated schema so that it declares explicit restriction. The option should be `true` by default so that it doesn't add anything in order to preserve current behavior.
An example of having `additionalProperties` to be `false`
https://github.com/igarashitm/example-generate-yaml-schema/blob/main/pom.xml#L71
And generated YAML schema from it
https://github.com/igarashitm/example-generate-yaml-schema/commit/85441fdcc6c641a2ef02aea7149a66a0429b3c92#diff-b1d8ab8b59f212acab62fab8cab033f98736c4bd9e92cc34fcf9b53457dbc1d0
Attachments
Issue Links
- links to