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

XML property ommited in RestModelConverters

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0-M3
    • None
    • camel-openapi-java

    Description

      The RestModelConverters class, which converts Swagger Models to OASSchemas, ommits entirely XML property of the model object.

      For exaple, having property "serverVersion" as XML Attritbute in generated Swagger Model:

      class Schema {
          type: object
          format: null
          $ref: null
          not: null
          properties: {
              serverVersion=class StringSchema {
                  class Schema {
                      type: string
                      format: null
                      $ref: null
                      properties: null
                      additionalProperties: null
                      deprecated: null
                      discriminator: null
                      xml: class XML {
                          name: null
                          namespace: null
                          prefix: null
                          attribute: true
                          wrapped: null
                      }
                  
                  }
              }
          }
      } 

      The given Oas30Schema is an output (shortened):

      model = {Oas30Schema$Oas30PropertySchema@19089} 
       _propertyName = "serverVersion"
       oneOf = null
       anyOf = null
       not = null
       discriminator = null
       xml = null
       externalDocs = null
       example = null 

      Instead of (shortened)

      model = {Oas30Schema$Oas30PropertySchema@10558} 
       _propertyName = "serverVersion"
       oneOf = null
       anyOf = null
       not = null
       discriminator = null
       xml = {Oas30XML@10561} 
        name = null
        namespace = null
        prefix = null
        attribute = {Boolean@19177} true
        wrapped = null
       externalDocs = null
       example = null 

      This leads to incorrectly generated api-doc which is used by Swagger, and therefore response example are also incorrect (all fields are XML elemements instead of some of them being attributes)

      Generated api-doc part:

       "serverVersion" : {
           "type" : "string"
       }

      Instead of:

       "serverVersion" : {
          "type" : "string",
          "xml" : {
             "attribute" : true
          }
       } 

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              marbom94 Jakub
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: