[
https://issues.apache.org/jira/browse/CAMEL-23992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-23992:
--------------------------------
Fix Version/s: 4.22.0
> camel-yaml-dsl-maven-plugin -
> GenerateYamlSchemaMojo.extractRequiredFromComposition has inverted $ref
> check: NPE on the branch it guards, no-op on the intended one
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-23992
> URL: https://issues.apache.org/jira/browse/CAMEL-23992
> Project: Camel
> Issue Type: Bug
> Components: camel-yaml-dsl
> Affects Versions: 4.21.0
> Reporter: Federico Mariani
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.22.0
>
>
> In {{GenerateYamlSchemaMojo.extractRequiredFromComposition}}
> ({{dsl/camel-yaml-dsl/camel-yaml-dsl-maven-plugin/.../GenerateYamlSchemaMojo.java:580-593}})
> the condition {{!compositionEntry.has("$ref")}} is inverted:
> * when the entry does *not* have {{$ref}}, the code immediately calls
> {{compositionEntry.get("$ref").asText()}} → NPE ({{get}} returns null);
> * when the entry *does* have {{$ref}}, the intended logic (dereference the
> parent definition and hoist its {{required}} list into the not/anyOf
> negation) is skipped entirely.
> Net effect: the method either crashes or silently extracts nothing, so
> {{makeOptional()}} produces incomplete negation constraints for optional
> oneOf-group members whose target definition has a composition. Currently
> latent — the schemas generated today hit the {{composition == null}} early
> return — but the logic has been wrong since inception ({{f5b2597d7630}},
> CAMEL-19698/19699) and will surface as soon as a composition-bearing
> definition enters an optional oneOf group.
> _Filed by Claude Code on behalf of Croway._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)