Nicolas Filotto created CAMEL-17741:
---------------------------------------
Summary: camel-yaml-dsl - Improper way to get the default name of
a field annotated XmlElement with
Key: CAMEL-17741
URL: https://issues.apache.org/jira/browse/CAMEL-17741
Project: Camel
Issue Type: Bug
Components: camel-yaml-dsl
Reporter: Nicolas Filotto
Fix For: 3.16.0
It appears that the plugin *camel-yaml-dsl-maven-plugin* doesn't retrieve the
default name of a property as the JAXB specification states.
Indeed, I have the next mapping:
{code:java}
@XmlElement
@Metadata(label = "security")
private List<SecurityDefinition> securityRequirements = new ArrayList<>();{code}
According the JAXB specification, if a field is annotated with the annotation
{_}XmlElement{_}, its name should be retrieved from the attribute "name" if set
otherwise it should use the field name.
With the current code, I end up with "{_}security{_}" corresponding to the
value of the attribute "{_}name{_}" of the annotation _XmlRootElement_ on the
class _SecurityDefinition_ as you can see below:
{code:java}
@Metadata(label = "rest,security,configuration", title = "Rest Security")
@XmlRootElement(name = "security")
@XmlAccessorType(XmlAccessType.FIELD)
public class SecurityDefinition {{code}
According to the specification, this behavior is actually only expected with a
field annotated with {_}XmlElementRef{_}.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)