[
https://issues.apache.org/jira/browse/CAMEL-19700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17753278#comment-17753278
]
Tomohisa Igarashi edited comment on CAMEL-19700 at 8/11/23 7:03 PM:
--------------------------------------------------------------------
Actually it's opposite, if the schema is to be extended with oneOf/anyOf/allOf,
i.e. ExpressionDefinition, it shouldn't have `additionalProperties: false`.
https://json-schema.org/understanding-json-schema/reference/object.html#extending-closed-schemas
IOW `addiontnalProperties: false` has to be added conditionally, by excluding
those are to be extended.
Taking above into account, the correct schema around expression would look like
this
https://github.com/igarashitm/misc/blob/main/camel/json-schema-yaml-validator/src/test/resources/schema/whenAndExpression.json
The point is to `redeclare` properties here. Even with this, the mutually
exclusiveness on expression is in effect on validation.
https://github.com/igarashitm/misc/blob/main/camel/json-schema-yaml-validator/src/test/resources/schema/whenAndExpression.json#L36-L38
Although it slightly gets verbose, still much better than the earlier
"redefine everything" version.
was (Author: igarashitm):
Actually it's opposite, if the schema is to be extended with oneOf/anyOf/allOf,
i.e. ExpressionDefinition, it shouldn't have `additionalProperties: false`.
https://json-schema.org/understanding-json-schema/reference/object.html#extending-closed-schemas
IOW `addiontnalProperties: false` has to be added conditionally, by excluding
those are to be extended.
> camel-yaml-dsl: Add "additionalProperties: false" on every sub schema
> ---------------------------------------------------------------------
>
> Key: CAMEL-19700
> URL: https://issues.apache.org/jira/browse/CAMEL-19700
> Project: Camel
> Issue Type: Task
> Components: camel-yaml-dsl
> Affects Versions: 4.0-RC2
> Reporter: Tomohisa Igarashi
> Assignee: Tomohisa Igarashi
> Priority: Major
>
> Currently the camel-yaml-dsl.json schema file doesn't have
> "additionalProperties: false" on each definitions. Since this property is
> "true" by default, if not explicitly specified to "false", schema validator
> allows arbitrary properties. In order to make this schema file work for
> validation, we'd want to add "additionalProperties: false" on every
> properties. The schema generator plugin already has that option.
> https://issues.apache.org/jira/browse/CAMEL-18829
--
This message was sent by Atlassian Jira
(v8.20.10#820010)