CAMEL-22987: Add strict YAML DSL JSON Schema variant#22059
CAMEL-22987: Add strict YAML DSL JSON Schema variant#22059
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
Full reactor (40 modules)
|
|
✅ Parent POM dependency changes: targeted tests passed Changed properties: smallrye-fault-tolerance-version Affected modules (1)
|
Add a strict JSON Schema variant (camelYamlDsl-strict.json) that removes
all implicit patterns from the YAML DSL schema:
- No string shorthands (e.g. log: "${body}" must be log: { message: ... })
- No inline expressions (e.g. setBody: { simple: ... } must use expression wrapper)
- No oneOf/anyOf/not constructs
This results in a ~25% smaller schema that is significantly easier for
tooling (IDEs, code generators, AI assistants) to process.
Changes:
- GenerateYamlSchemaMojo: add strict parameter to skip inline, __extends, oneOf
- pom.xml: add second execution to generate strict schema
- YamlValidator: add strict constructor to validate against strict schema
- 7 new tests validating strict vs classic schema behavior
- Documentation in yaml-dsl.adoc and upgrade guide
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2ea6aa0 to
81903c5
Compare
|
The CI failure here is caused by flaky This should be fixed by #22081 which addresses the SMB test issues. Once that's merged, re-running CI here should go green. |
apupier
left a comment
There was a problem hiding this comment.
I think it will be worthy that some people from Kaoto review also this PR to see if the strict way is matching what is supported currently, or at least if there is no blocker to support it easily.
//cc @lordrip
Note that we will need to change the default when exporting from Camel JBang, updating most examples and publish it along the other one in Json schemastore
Summary
camelYamlDsl-strict.json) that removes all implicit patterns from the YAML DSL schema: no string shorthands, no inline expressions, nooneOf/anyOf/notconstructscamelYamlDsl.json) is unchanged and continues to support all existing shorthandsChanges
GenerateYamlSchemaMojo: newstrictparameter that skipsinlinestring shorthands,__extendsexpression merging, andoneOfgroupingcamel-yaml-dsl/pom.xml: second execution to generate the strict schemaYamlValidator: newboolean strictconstructor parameter to validate against either schemayaml-dsl.adocexplaining both schema variants with examplescamel-4x-upgrade-guide-4_19.adocTest plan
log: "${body}")setBody: { simple: "..." })