Skip to content

how to prepend xml version and encoding #2213

@bglmac

Description

@bglmac

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions