represent a xml on Swagger yaml

后端 未结 1 1075
余生分开走
余生分开走 2021-01-25 22:46

I\'m making a document on swagger editor, but I don\'t know how solve that..

What do I need to write in a YAML file to get this result?


    &         


        
相关标签:
1条回答
  • 2021-01-25 23:09

    I believe you'd do it like this:

    definitions:
      Tag:
        xml:
          # use `tag` instead of `Tag` as the name
          name: tag
        properties:
          example:
            type: array
            items:
              $ref: '#/definitions/Example'
            xml:
              # don't wrap array
              wrapped: false
      Example:
        type: object
        properties:
          Amount:
            type: number
            format: float
            xml:
              # it's an attribute, not an element
              attribute: true
          NumberOfGuests:
            type: integer
            format: int32
            xml:
              attribute: true
    

    Note the xml attributes to tell how to format the XML specific payload in JSON Schema. More on that structure is found here.

    0 讨论(0)
提交回复
热议问题