XML Post not working?
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"
As of now, try operation does not support XML.
What exactly do you expect with this swagger?
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.
i'm having the same problem, what you did about it?
This should no longer be an issue in 3.X.