Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to prepend xml version and encoding #2213

Closed
bglmac opened this issue Apr 22, 2020 · 1 comment
Closed

how to prepend xml version and encoding #2213

bglmac opened this issue Apr 22, 2020 · 1 comment

Comments

@bglmac
Copy link

bglmac commented Apr 22, 2020

i am using swagger in golang, and here's the endpoint:

"/xmltest":{
      "get":{
        "produces":["application/xml"],
        "operationId":"xmltest",
        "responses":{
          "200":{
            "description":"OK",
            "schema":{
              "type":"array",
              "items":{
                "$ref":"#/definitions/Channel"
              },
              "xml":{"name":"Channels"}
            }
          }
        }
      }
    }

and definition:

"Channel":{
      "type":"object",
      "xml":{"name":"Channel", "version":"1.0.0", "encoding":"utf-8"},
      "properties":{
        "id":{
          "format":"int32",
          "type":"integer"
        },
        "name":{
          "type":"string"
        }
      }
    }

in the response, i am always get <Channel><ID>1</ID><Name>Abc</Name></Channel> while i am expecting <?xml version="1.0" encoding="utf-8"?><Channel><ID>1</ID><Name>Abc</Name></Channel>, how can i make it happen?

@MikeRalphson
Copy link
Member

MikeRalphson commented Apr 22, 2020

You do not state exactly which tool you're using, but I do think this is a tooling, rather than a spec. issue, so should be raised on the relevant tooling repository.

Just for clarity, the xmlObject does not support a version or encoding field, so this is not going to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants