swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

XML Post not working?

Open chrisdudley opened this issue 10 years ago • 4 comments

I have the following test YAML. The JSON operation works fine, but the XML one doesn't. The body content isn't put into the try operation.

The Content-Type field also doesn't seem to be preset to "application/xml" for the XML operation either, despite it being the only value listed in 'consumes' for that operation.

(Using latest code on editor.swagger.io)


---
swagger: "2.0"
info:
  version: "1.0.0"
  title: "Demo"
host: "example.com"
basePath: "/v2"
paths:
  /test.xml:
    post:
      tags: []
      summary: "XML"
      description: ""
      parameters:
      - schema:
          type: "object"
          properties:
            Thing:
              type: "string"
        description: ""
        name: "body"
        in: "body"
      responses:
        201:
          schema: {}
          description: ""
      consumes:
      - application/xml
      produces:
      - application/xml
  /test.json:
    post:
      tags: []
      summary: "JSON"
      description: ""
      parameters:
      - schema:
          type: "object"
          properties:
            Thing:
              type: "string"
        description: ""
        name: "body"
        in: "body"
      responses:
        201:
          schema: {}
          description: ""
      consumes:
      - application/json
      produces: 
      - application/json
definitions: {}
schemes:
- "https"

chrisdudley avatar Jan 29 '16 11:01 chrisdudley

As of now, try operation does not support XML.

What exactly do you expect with this swagger?

saharj avatar Feb 01 '16 05:02 saharj

I am fairly sure it used to support XML. Adding try support to swagger editor back in Dec 2014 even has XML support ticked off. So what I was expecting to happen is what the spec says - swagger editor would take the JSON schema representation and generate an object of the required content type (as set by 'Content-Type'), in this case application/xml. There are XML specific attributes that can be set in the JSON Schema, but they are not required.

chrisdudley avatar Feb 01 '16 09:02 chrisdudley

i'm having the same problem, what you did about it?

igoralvess avatar Oct 17 '16 13:10 igoralvess

This should no longer be an issue in 3.X.

webron avatar Jun 08 '17 23:06 webron