'How can I create a swagger yaml contract to specify an end going that always returns a xml object

How can I create a swagger yaml contract to specify an end going that always returns a xml object.

I have tried to create one but the object displayed is not 100% the same as what I actually get back.

the endpoint that I want to read / get the xml from is this

https://www.somecompany.com/xmlfeed/test.xml

Below is my swagger and below that is what I actual data read back.

---
swagger: "2.0"
info:
  description: "The XML service describes something"
  version: "1"
  title: "Some XML - service"
  contact:
    name: "some service"
    email: "[email protected]"
  x-responsibleTeam: "Techies"
  termsOfService: "TBC."

basePath: "/"
schemes:
  - "https"
paths:
  /xmlfeed:
    get:
      summary: "Retrieve the thing results information for specific  things"
      description: "Retrieve the thing results information for specific  things"
      operationId: "xmlfeed"
      parameters:
      - name: "thingName"
        in: "query"
        description: "The name of the thing for which to retrieve the rules."
        required: true
        type: "string"
        enum:
        - ".xml"
      produces:
        - "text/xml"
      responses:
        200:
          description: "Success"
          schema:
            $ref: "#/definitions/Data"
        400:
          description: "Bad Request"
          schema:
            $ref: "#/definitions/ErrorDetail"
        401:
          description: "Indicates a token is required."
          schema:
            $ref: "#/definitions/ErrorDetail"
        500:
          description: "Any server error conditions."
          schema:
            $ref: "#/definitions/ErrorDetail"
        503:
          description: "Service Unavailable"
          schema:
            $ref: "#/definitions/ErrorDetail"
        504:
          description: "Gateway Timeout"
          schema:
            $ref: "#/definitions/ErrorDetail"

#PARAMETER AND REFERENCE DEFINITIONS
definitions:
  AmountsXml:
    type: "string"
    properties:
      xmlResponseAmountformat:
        type: "string"
        description: "amount formatting"
        pattern: "^[0-9]{1,25}.[0-9]{2}$"
    description: "Amounts which make up the responses. Absent amounts have zero\
      \ value."
  Data:
    allOf:
      - $ref: "#/definitions/Record"
      - type: "object"
        properties:
          record:
            type: "object"
            description: "The list of thing results, per thing."
            items:
              $ref: "#/definitions/Record"
        description: "One object"
        xml:
        name: 'data'
  
  Field:
    type: "object"
    properties:
      drawDate:
        description: "The date of the current results"
        type: "string"
        pattern: "[0-9]{1,20}-[0-9]{2}-[0-9]{2}T[0-9]{2}"
      nextDrawDate:
        description: "The next thing draw date"
        type: "string"
        pattern: "[0-9]{1,20}-[0-9]{2}-[0-9]{2}T[0-9]{2}"
      drawNumber:
        type: "string"
        description: "The minimum number of boards that can be played per wager"
        pattern: "[0-9]{1,3}"
      ball1:
        type: "string"
        description: "The ball1 number"
        pattern: "[0-9]{1}"
      ball2:
        type: "string"
        description: "The ball2 number"
        pattern: "[0-9]{1}"
      ball3:
        type: "string"
        description: "The ball3 number"
        pattern: "[0-9]{1}"
      ball4:
        type: "string"
        description: "The ball4 number"
        pattern: "[0-9]{1}"
      ball5:
        type: "string"
        description: "The ball5 number"
        pattern: "[0-9]{1}"
      ball6:
        type: "string"
        description: "The ball6 number"
        pattern: "[0-9]{1}"
      bonusBall:
        type: "string"
        description: "The BonusBall number"
        pattern: "[0-9]{1}"
      powerBall:
        type: "string"
        description: "The Powerball number"
        pattern: "[0-9]{1}"
      div1Winners :
        type: "string"
        description: "The Div1Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div1Payout :
        type: "string"
        description: "The Div1Payout detailsr"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div2Winners :
        type: "string"
        description: "The Div2Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div2Payout :
        type: "string"
        description: "The Div2Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div3Winners :
        type: "string"
        description: "The Div3Winners detailsr"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div3Payout :
        type: "string"
        description: "The Div3Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div4Winners :
        type: "string"
        description: "The Div4Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div4Payout :
        type: "string"
        description: "The Div4Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div5Winners :
        type: "string"
        description: "The Div5Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div5Payout :
        type: "string"
        description: "The Div5Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div6Winners :
        type: "string"
        description: "The Div6Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div6Payout :
        type: "string"
        description: "The Div6Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div7Winners :
        type: "string"
        description: "The Div7Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div7Payout :
        type: "string"
        description: "The Div7Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div8Winners :
        type: "string"
        description: "The Div8Winners details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      div8Payout :
        type: "string"
        description: "The Div8Payout details"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      rolloverAmount  :
        description: "The RolloverNumber value"
        $ref: "#/definitions/AmountsXml"
      rolloverNumber :
        type: "string"
        description: "The RolloverNumber value"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      totalPrizePool :
        $ref: "#/definitions/AmountsXml"
        description: "The TotalPrizePool amount"
      totalSales :
        type: "string"
        description: "The Total sales for thing (per thing)"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      estimatedJackpot :
        $ref: "#/definitions/AmountsXml"
        description: "The Esmiated Jackpot Amount"
      guaranteedJackpot :
        $ref: "#/definitions/AmountsXml"
        description: "The Guaranteed Jackpot Amount"
      drawMachine :
        type: "string"
        description: "The drawmachine used"
        pattern: "[0-9]{1,20}"
      ballSet :
        type: "string"
        description: "The Ballset Indicator number"
        pattern: "[0-9]{1,20}"
      gpWinners :
        type: "string"
        description: "The total number of Gauteng province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      wcWinners :
        type: "string"
        description: "The total number of Western Cape province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      ncWinners :
        type: "string"
        description: "The total number of Nothern Cape province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      ecWinners :
        type: "string"
        description: "The total number of Eastern Cape province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      mpWinners :
        type: "string"
        description: "The total number of Mpumalange province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      lpWinners :
        type: "string"
        description: "The total number of Limpopo province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      fsWinners :
        type: "string"
        description: "The total number of Free State province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      kznWinners :
        type: "string"
        description: "The total number of KZN province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
      nwWinners:
        type: "string"
        description: "The total number of Northwest province winners"
        pattern: "[0-9]{1,20}.[0-9]{2}|[0-9]{1,20}"
  Record:
    allOf:
    - $ref: "#/definitions/Field"
    - type: "object"
      properties:
        items:
          type: "object"
          description: "field object"
            
      description: "Contains the list of fields."
      xml:
        name: 'record'
  ErrorDetail:
    type: "object"
    required:
      - "errorMessage"
      - "errorType"
      - "id"
      - "requestType"
    properties:
      id:
        type: "string"
        description: "The randomly generated UUID identifying this errorDetail, as\
          \ defined for a variant 4 UUID in [RFC 4122](https://tools.ietf.org/html/rfc4122)"
        pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-(3|4)[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      originalId:
        type: "string"
        description: "The UUID of the original request message in the case of an error\
          \ occurring for an advice message"
        pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-(3|4)[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
      errorType:
        type: "string"
        description: "The type of error that occurred"
        enum:
          - "DUPLICATE_RECORD"
          - "FORMAT_ERROR"
          - "FUNCTION_NOT_SUPPORTED"
          - "GENERAL_ERROR"
          - "INVALID_AMOUNT"
          - "ROUTING_ERROR"
          - "TRANSACTION_NOT_SUPPORTED"
          - "UNABLE_TO_LOCATE_RECORD"
          - "UPSTREAM_UNAVAILABLE"
          - "INVALID_PRODUCT"
          - "ACCOUNT_ALREADY_SETTLED"
          - "AUTH_ERROR"
          - "INVALID_MERCHANT"
          - "REVISION_CHANGE"
          - "DRAW_NOT_OPEN"
      errorMessage:
        type: "string"
        description: "A short description of the error"
        pattern: "^[ -;=\\?-Z\\^-z\\|~]{0,20}$"
      requestType:
        type: "string"
        description: "The type of request that preceeded the error"
        enum:
          - "WAGER_REQUEST"
          - "WAGER_REVERSAL"
          - "WAGER_CONFIRMATION"
          - "thing_RULES_REQUEST"
      detailMessage:
        type: "object"
        description: "A free form detailed description of a particular failure condition\
          \ may optionally be supplied"
    description: "Represents the outcome of a completed transaction"
  ErrorDetailResults:
    type: "object"
    required:
      - "errorMessage"
      - "errorType"
      - "id"
      - "requestType"
    properties:
      id:
        type: "string"
        description: "The randomly generated UUID identifying this errorDetail, as\
          \ defined for a variant 4 UUID in [RFC 4122](https://tools.ietf.org/html/rfc4122)"
        pattern: "^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$"
        minLength: 0
        maxLength: 20
      originalId:
        type: "string"
        description: "The UUID of the original request message in the case of an error\
          \ occurring for an advice message"
        pattern: "^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$"
      errorType:
        type: "string"
        description: "The type of error that occurred"
        enum:
          - "INVALID_thing"
          - "FORMAT_ERROR"
          - "FUNCTION_NOT_SUPPORTED"
          - "GENERAL_ERROR"
          - "ROUTING_ERROR"
          - "UNABLE_TO_LOCATE_RECORD"
          - "UPSTREAM_UNAVAILABLE"
          - "AUTH_ERROR"
          - "RESULTS_NOT_AVAILABLE"
      errorMessage:
        type: "string"
        description: "A short description of the error"
        minLength: 0
        maxLength: 20
        pattern: "[A-Na-n0-9]{1,20}"
      requestType:
        type: "string"
        description: "The type of request that preceeded the error"
        enum:
          - "RESULTS_REQUEST"
      detailMessage:
        type: "object"
        description: "A free form detailed description of a particular failure condition\
          \ may optionally be supplied"
        pattern: "[A-Na-n0-9]{1,40}"
        minLength: 0
        maxLength: 40
    description: "Represents the outcome of a completed transaction"
 

the output

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<data>
<record>
<field name="DrawDate" value="2022/01/29"/>
<field name="NextDrawDate" value="2022/02/02"/>
<field name="DrawNumber" value="2199"/>
<field name="Ball1" value="34"/>
<field name="Ball2" value="52"/>
<field name="Ball3" value="8"/>
<field name="Ball4" value="19"/>
<field name="Ball5" value="36"/>
<field name="Ball6" value="10"/>
<field name="BonusBall" value="2"/>
<field name="Div1Winners" value="0"/>
<field name="Div1Payout" value="0"/>
<field name="Div2Winners" value="1"/>
<field name="Div2Payout" value="94046.50"/>
<field name="Div3Winners" value="51"/>
<field name="Div3Payout" value="3207.10"/>
<field name="Div4Winners" value="129"/>
<field name="Div4Payout" value="1584.90"/>
<field name="Div5Winners" value="2238"/>
<field name="Div5Payout" value="153.50"/>
<field name="Div6Winners" value="3138"/>
<field name="Div6Payout" value="95.10"/>
<field name="Div7Winners" value="43536"/>
<field name="Div7Payout" value="50.00"/>
<field name="Div8Winners" value="35281"/>
<field name="Div8Payout" value="20.00"/>
<field name="RolloverAmount" value="5500022.23"/>
<field name="RolloverNumber" value="2"/>
<field name="TotalPrizePool" value="9486459.73"/>
<field name="TotalSales" value="15491995.00"/>
<field name="EstimatedJackpot" value="8000000.00"/>
<field name="GuaranteedJackpot" value="0"/>
<field name="DrawMachine" value="RNG2"/>
<field name="BallSet" value="RNG"/>
<field name="GPWinners" value="84374"/>
<field name="WCWinners" value="0"/>
<field name="NCWinners" value="0"/>
<field name="ECWinners" value="0"/>
<field name="MPWinners" value="0"/>
<field name="LPWinners" value="0"/>
<field name="FSWinners" value="0"/>
<field name="KZNWinners" value="0"/>
<field name="NWWinners" value="0"/>
</record>
</data>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source