Luigi De Masi created CAMEL-25347:
-------------------------------------
Summary: camel-yaml-dsl: Validate scalar alternatives without
losing required fields
Key: CAMEL-25347
URL: https://issues.apache.org/jira/browse/CAMEL-25347
Project: Camel
Issue Type: Bug
Components: camel-yaml-dsl, camel-core
Reporter: Luigi De Masi
The YAML validator can report errors from the wrong oneOf/anyOf alternative
when a scalar uses a form accepted by the runtime (for example, a quoted number
or a property placeholder). Filtering those scalar errors must not hide
genuinely missing required fields, and alternative selection must distinguish
separate YAML locations.
For example, validate a semantic boolean question with instructions and
threshold: "{{limit:0.1}}". This should be accepted like the numeric literal
0.1; malformed fields and missing required declarations must still fail.
The existing CAMEL-25238 fix introduced
removeSatisfiedAlternatives/constructOf. Replace that workaround with
alternative selection per YAML location and ranking that accounts for runtime
scalar conversions, retaining all original CAMEL-25238 regression tests.
There is also a source metadata inconsistency exposed by preserving
required-field errors: ParamDefinition.getType() defaults to path, but its
XmlAttribute is marked required. Correct the source annotation and regenerate
the published schemas so both the Camel validator and other schema consumers
accept the same REST definition. Do not modify the schema only at validation
time.
This work is split from CAMEL-25310 following review of
https://github.com/apache/camel/pull/27373#pullrequestreview-5415057613.
Regression coverage should include multiple YAML locations, placeholders and
quoted numbers, required fields, existing oneOf diagnostics, and REST
parameters with an omitted type.
AI-generated by Codex on behalf of GitHub operator @luigidemasi.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)