Ask a Question

OpenAPI 3.0 - Issue describing an object for XML tag in OpenAPI 3.0 objects that have

salem
Occasional Visitor

OpenAPI 3.0 - Issue describing an object for XML tag in OpenAPI 3.0 objects that have

I can't get Swagger UI to create an appropriate XML tag with an attribute and content ( objects that have both attributes and a value ) :

 

<filter id="id001" attr1="admin">Administrator</filter>

and instead, I get this

 

<filter>Administrator</filter>

 

if I use this schema

 

components:
  schemas:
    Filter:
      type: object
      example: Administrator
      properties:
        id:
          type: string
          example: id001
          xml:
            attribute: true
        attr1:
          type: string
          example: admin
          xml:
            attribute: true

or this

<filter attr1="id001" attr1="admin"></filter>

 

if I use this schema

 

components:
  schemas:
    Filter:
      type: object
      properties:
        id:
          type: string
          example: id001
          xml:
            attribute: true
        attr1:
          type: string
          example: admin
          xml:
            attribute: true

 

I try many ways to solve this issue but no luck

3 REPLIES 3
Warden101
Occasional Visitor

Re: OpenAPI 3.0 - Issue describing an object for XML tag in OpenAPI 3.0 objects that have

Change your schemas as follows. EmployeesInfo should be defined as an array and have xml.wrapped  = true. Also make sure each schema specifies the xml.name with the corresponding XML tag name skylightpaycard login.

components:
  ...

  schemas:
    Employee:
      type: object
      ...
      xml:
        name: Employee

    EmployeesInfo:
      type: array
      items:
        $ref: '#/components/schemas/Employee'
      xml:
        name: Employees
        wrapped: true

 

Harsh12
New Contributor

Re: OpenAPI 3.0 - Issue describing an object for XML tag in OpenAPI 3.0 objects that have

Change your schemas as follows. EmployeesInfo should be defined as an array and have xml.wrapped  . Thankyou for this. myolsd 

Harsh12
New Contributor

Re: OpenAPI 3.0 - Issue describing an object for XML tag in OpenAPI 3.0 objects that have

I tried the whole thing step by step I don't know why am I not getting it. myaccessflorida 

cancel
Showing results for 
Search instead for 
Did you mean: