SVN600
SVN600

Reputation: 385

Adding Implementation Notes and Description to Swagger UI

I am attempting to add Implementation Notes and Description to my Swagger UI. However, neither show up on the UI when implemented as below:

{
"swagger" : "2.0",
"info" : {
    "description" : "The definition of the Rest API to service plugin over https on port 9443.",
    "version" : "1.0",
    "title" : "Plugin Rest API",
    "contact" : {
       "name" : "John Doe",
      "email" : "[email protected]"
    }
},
"basePath" : "/service",
"tags" : [ {
    "name" : "service"
  } ],
"schemes" : [ "https" ],
"paths" : {
"/entry" : {
   "get" : {
       "notes" : "This is a note",
       "method" : "get",
       "tags" : [ "service" ],
       "summary" : "Get an entry by first name and last name",
       "description" : "This is a description",
       "operationId" : "getEntry",
       "produces" : [ "application/xml", "application/json" ],
       "parameters" : [ {
           "name" : "first",
           "in" : "query",
           "description" : "The first name",
           "required" : true,
           "type" : "string"
        }, {
      "name" : "last",
      "in" : "query",
      "description" : "The last name",
      "required" : true,
      "type" : "string"
    } ],
    "responses" : {
      "200" : {
        "description" : "Matching entry, or entries, if any, were returned",
        "schema" : {
          "$ref" : "#/definitions/Service"
        }
      }
    }   
  },

I am not sure what I am doing wrong in my code. I've tested it on various sample swagger.json files and I cannot seem to get it to work.

Upvotes: 2

Views: 10855

Answers (2)

Hardik Patel
Hardik Patel

Reputation: 1138

you can add implementation notes using notes tag in @ApiOperation annotation as shown below,

@ApiOperation(notes = "Your Implementation Notes will show here[![enter image description here][1]][1]", value = "Add Customer Payment Details and Generate Payment Link through Batch.", nickname = "insertPaymentBatch",  tags = 
            "Insert Payment" )

It will show like this in Swagger UI.

Upvotes: 0

M07
M07

Reputation: 1131

notes is not a swagger field. See the documentation

Your description field is written twice, so the first one has been overridden.

Upvotes: 1

Related Questions