헤더 값 형식 정의 누락

OpenAPI 3.0 헤더 값의 타입과 형식을 schema 또는 content로 정의합니다.

설명

OpenAPI 3.0 응답 헤더는 값의 형식을 정의해야 합니다. 설명만으로는 타입을 알 수 없습니다.

잠재적 영향

SDK가 숫자 헤더를 문자열로 취급하거나 값을 잘못 해석할 수 있습니다.

해결 방법

schema에 헤더 값의 타입과 제약을 지정하거나, 미디어 타입 하나로 표현한다면 content를 사용하세요. 공용 헤더는 $ref가 가리키는 정의를 확인하세요.

예시

예시는 현재 기간에 허용되는 요청 수를 나타내는 X-Rate-Limit-Limit 헤더의 스키마에 type: integer를 지정합니다.

변경 전

json
{
  "openapi": "3.0.0",
  "components": {
    "responses": {
      "ResponseExample": {
        "headers": {
          "X-Rate-Limit-Limit": {
            "description": "The number of allowed requests in the current period"
          }
        }
      }
    }
  }
}

변경 후

json
{
  "openapi": "3.0.0",
  "components": {
    "responses": {
      "ResponseExample": {
        "headers": {
          "X-Rate-Limit-Limit": {
            "description": "The number of allowed requests in the current period",
            "schema": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}

참조