Trying to add xml example of response in swagger but it doesn`t show

I am building an API Documentation with Swagger and I am writing directly in Notepad++ in the JSON it all woks fine but now I have a POST request that has a response example of type xml. This is the code that I have written

"/stareMesaj":{
      "get": {
        "summary": "Returns a list of users",
        "description": "Blabla bla",
        "produces": [
          "application/xml"
        ],
        "responses": {
          "200": {
            "description": "ok",
            "examples": {
              "application/xml": "<users><user>Alice</user><user>Bob</user></users>"
            }
          }
        }
      }
    }
  }

Can you please give me advice on what is wrong because when I convert it to html with redoc it doesnt show any response example on the right side of the page.

Thanks in advance

Preface: I dont know Swagger. This post is the result of 30 seconds of googling.

Your structure doesn’t appear to match Swagger’s specification. It doesnt know what “examples” is at that context level. (You forgot the ‘content’ level?)
https://swagger.io/docs/specification/describing-responses/

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.