설명
공통 응답 헤더를 참조할 때는 components.headers의 정의 이름을 대소문자까지 일치시키세요. HTTP 헤더 이름 자체는 대소문자를 구분하지 않습니다.
잠재적 영향
끊어진 참조로 인해 생성된 문서에서 헤더 형식이 빠지거나 클라이언트 생성이 실패할 수 있습니다.
해결 방법
로컬 $ref의 경로와 이름을 고치세요. 외부 참조라면 대상 파일과 안쪽 경로를 확인한 뒤 명세를 검증하세요.
예시
변경 전
json
{
"openapi": "3.0.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MyObject"
}
}
}
},
"headers": {
"X-Pages": {
"$ref": "#/components/headers/wPages"
}
}
}
}
}
}
},
"components": {
"schemas": {
"MyObject": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
},
"headers": {
"xPages": {
"schema": {
"type": "integer",
"description": "number of pages"
}
}
}
}
}
변경 후
json
{
"openapi": "3.0.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/MyObject"
}
}
}
},
"headers": {
"X-Pages": {
"$ref": "#/components/headers/xPages"
}
}
}
}
}
}
},
"components": {
"schemas": {
"MyObject": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
},
"headers": {
"xPages": {
"schema": {
"type": "integer",
"description": "number of pages"
}
}
}
}
}
200 응답의 X-Pages는 정의되지 않은 wPages 대신 xPages를 참조합니다. 이 정의는 페이지 수를 정수로 표시합니다.