설명
#/responses/... 참조는 실제로 정의된 공통 응답을 가리켜야 합니다. 대상이 없으면 작업의 응답 설명과 본문 구조를 불러올 수 없습니다.
잠재적 영향
문서나 클라이언트 코드 생성이 실패하거나 응답 정보가 누락될 수 있습니다.
해결 방법
responses의 정의 이름과 $ref를 대소문자까지 일치시키세요. 응답 이름을 바꾸거나 삭제할 때는 이를 참조하는 작업도 함께 수정하세요.
예시
다음 예시는 오타인 Succes를 실제 응답 이름인 Success로 수정합니다.
변경 전
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"$ref": "#/responses/Succes"
}
}
}
}
},
"responses": {
"Success": {
"description": "A user",
"schema": {
"$ref": "#/definitions/User"
}
}
},
"definitions": {
"User": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
}
}
변경 후
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"$ref": "#/responses/Success"
}
}
}
}
},
"responses": {
"Success": {
"description": "A user",
"schema": {
"$ref": "#/definitions/User"
}
}
},
"definitions": {
"User": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
}
}