Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-17741

camel-yaml-dsl - Improper way to get the default name of a field annotated with XmlElement

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.16.0
    • camel-yaml-dsl
    • None
    • Unknown

    Description

      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:

      @XmlElement
      @Metadata(label = "security")
      private List<SecurityDefinition> securityRequirements = new ArrayList<>();

      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:

      @Metadata(label = "rest,security,configuration", title = "Rest Security")
      @XmlRootElement(name = "security")
      @XmlAccessorType(XmlAccessType.FIELD)
      public class SecurityDefinition {

      According to the specification, this behavior is actually only expected with a field annotated with XmlElementRef.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            essobedo Nicolas Filotto
            essobedo Nicolas Filotto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment