[ 
https://issues.apache.org/jira/browse/CAMEL-19700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17751090#comment-17751090
 ] 

Tomohisa Igarashi edited comment on CAMEL-19700 at 8/4/23 11:42 AM:
--------------------------------------------------------------------

Here is an extracted *when* for testing
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-simplifiedwhenschema-json

And the *additionalProperties: false* below even disallow when.description
 
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-simplifiedwhenschema-json-L43
It means that if *anyOf*/*oneOf* is specified, *properties* is ignored.


Instead, I think it needs to be like this way - 
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json

*oneOf*/*anyOf* has to be an array of schema, but cannot be used to reduce 
properties
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json-L15-L97

And *ExpressionDefiition* needs one more layer, e.g. 
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json-L126
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json-L133-L140

According to what I talked with Luca about this, it seems at the time 
camel-yaml-dsl was developed, there were problems preventing from doing this 
straightforward way and ended up with the current hack. As it already passed 
years after that, let's revisit and try fixing it.


was (Author: igarashitm):
Here is an extracted *when* for testing
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-simplifiedwhenschema-json

And the *additionalProperties: false* below even disallow when.description
 
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-simplifiedwhenschema-json-L43

It means that if *anyOf*/*oneOf* is specified, *properties* is ignored.
Instead, I think it needs to be like this way - 
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json

*oneOf*/*anyOf* has to be an array of schema, but cannot be used to reduce 
properties
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json-L15-L97

And *ExpressionDefiition* needs one more layer, e.g. 
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json-L126
https://gist.github.com/igarashitm/0969d26e1463bf6b54dc5c52236b4110#file-correctedwhenschema-json-L133-L140

According to what I talked with Luca about this, it seems at the time 
camel-yaml-dsl was developed, there were problems preventing from doing this 
straightforward way and ended up with the current hack. As it already passed 
years after that, let's revisit and try fixing it.

> 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)

Reply via email to