apupier commented on issue #358:
URL: https://github.com/apache/camel-k-runtime/issues/358#issuecomment-652832852


   > > There is an error message `Matches multiple schemas when only one must 
validate.` but it smells a limitation on yaml Language server. it seems there 
is a workaround to shut ignore the error in the yaml language server especially 
for that for Kubernetes schema 
https://github.com/redhat-developer/yaml-language-server/blob/8f8a4c52363d2c8c003e08b12cb7db97550afbca/src/languageservice/services/yamlValidation.ts#L91
   > 
   > in fact, it seems that it is coming from 
https://github.com/microsoft/vscode-json-languageservice/blame/fad098244642100e5054dedefed9da905b24aedc/src/parser/jsonParser.ts#L458
 and Yaml Language Server has put a workaround flag to ignore this error.
   > 
   > If i understand well, this message is provided when several different 
elements are matching the same tag.
   > I found that several json schema has been modified to avoid that it occurs 
but wasn't able to find a pattern on how they fixed it.
   > For Kubernetes, it seems that they just put the silent mode at Yaml 
language Server level.
   
   as suggested here 
https://github.com/microsoft/vscode-json-languageservice/issues/60#issuecomment-652753506
 using `anyOf` instead of `oneOf` should avoid the warning.
   From what I understand of the difference between the two is only at 
validation where the `oneOf` is that we want a single possible schema.
   
   
http://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.9.2.1.2
   
   <pre><code>
   9.2.1.2. anyOf
   This keyword's value MUST be a non-empty array. Each item of the array MUST 
be a valid JSON Schema.
   
   An instance validates successfully against this keyword if it validates 
successfully against <b>at least one schema</b> defined by this keyword's 
value. Note that when annotations are being collected, all subschemas MUST be 
examined so that annotations are collected from each subschema that validates 
successfully.
   
   9.2.1.3. oneOf
   This keyword's value MUST be a non-empty array. Each item of the array MUST 
be a valid JSON Schema.
   
   An instance validates successfully against this keyword if it validates 
successfully against <b>exactly one schema</b> defined by this keyword's value.
   </pre>
   
   so i think that we need to use `anyOf` instead of `oneOf` in our case.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to