Forum Discussion

flotonus's avatar
flotonus
New Contributor
2 years ago

API Auto Mocking - application/xml response fails with namespace or attribute definitions

Hi,

I have created a simple API spec based on Open API 3.0 for returning a response of type 'application/xml' . If I use the xml.namespace declaration or xml.attribute: true the API Auto Mocking fails and returns the message "Missing matching response for specified Accept header". If I omit namespace or attribute declarations everything is fine.

 

Am I missing something or does the API Auto Mocking indeed not support namespaces or attributes?

 

The API spec is

 

 

openapi: 3.0.0
servers:
  # Added by API Auto Mocking Plugin
  - description: SwaggerHub API Auto Mocking
    url: https://virtserver.swaggerhub.com/FLOWEWI_1/XMLtest-api/1.0.0
info:
  version: 1.0.0
  title: XML Test API
  description: Testing XML support of Swagger for POST request & response
paths:
  /simplest:
    post:
      summary: Simple POST request with no XML payload handed over
      
      responses:
        '200':
          description: OK
          headers:
            X-Correlation-ID:
              schema:
                type: string
              example: '9749332323834'
          content:
            'application/xml':
              schema:
                $ref: '#/components/schemas/GetSimplestResponse'
                
components:
  schemas:
    GetSimplestResponse:
      type: object
      xml:
        namespace: 'https://www.veloconnect.de/fileadmin/spec_1_3/doc/urn_veloconnect_catalog-1.1/index.html'
      
      properties:
        BuyersID:
          type: string
          example: 'B127645'
        test:
          type: string
          xml:
            attribute: true
          example: 'YES'