Jakub created CAMEL-19406:
-----------------------------

             Summary: XML property ommited in RestModelConverters
                 Key: CAMEL-19406
                 URL: https://issues.apache.org/jira/browse/CAMEL-19406
             Project: Camel
          Issue Type: Bug
          Components: camel-openapi-java
    Affects Versions: 4.0-M3
            Reporter: Jakub


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:
{code:java}
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
                }
            
            }
        }
    }
} {code}
The given Oas30Schema is an output (shortened):
{code:java}
model = {Oas30Schema$Oas30PropertySchema@19089} 
 _propertyName = "serverVersion"
 oneOf = null
 anyOf = null
 not = null
 discriminator = null
 xml = null
 externalDocs = null
 example = null {code}
Instead of (shortened)
{code:java}
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 {code}
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:
{code:java}
 "version" : {
     "type" : "string"
 }{code}
Instead of:
{code:java}
 "version" : {
    "type" : "string",
    "xml" : {
       "attribute" : true
    }
 } {code}
 

PS. this is my first issue created here so please let me know if I should 
provide additional information or change anything in the ticket.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to