The API response format is like this (there are more attributes under couponReportData
but not showing here)-
{
"status": "success",
"success_id": "S-001",
"message": "Request processed successfully",
"couponReportData": [
{
"uuid": "8432732587408386841",
},
{
"uuid": "7916954142184535581",
}
]
}
I am trying to write the swagger documentation for the same by editing the json file (which is specified in the redoc spec-url attribute of the swagger html file).
Following is what I have written so far within the paths
attribute of json -
"paths": {
"/endPoint": {
"get": {
"tags": ["Fetch Data Apis"],
"summary": "summary",
"operationId": "fetchcouponGET",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResultDTO1_endpoint"
}
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
},
"404": {
"description": "Not Found"
}
}
}
},
"definitions": {
"ResultDTO1_endpoint": {
"type": "object",
"properties": {
"status": {
"type": "string",
"description": "Api status success or error",
"example": "success"
},
"success_id": {
"type": "string",
"description": "When success Response",
"example": "S-001"
},
"message": {
"type": "string",
"description": "Api message response",
"example": "Request processed successfully"
},
"couponReportData": {
"type": "object",
"properties": {
"uuid": {
"type": "integer",
"description": "Some description",
"example": "2"
}
}
}
}
}
}
Following is what I am getting in the response section of generated Swagger doc -
Update
After the solution mentined by Helen, the Response sample part is getting generated correctly, but the response schema is still confusing -