본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

요청 검증 정책 구성 참조

원문 보기 위키 갱신

요청 검증 정책 구성 참조 (Request Validator Policy Configuration Reference)

이 문서는 Kong의 요청 검증(Request Validator) 정책에서 설정할 수 있는 구성 옵션을 하나씩 정리해 놓은 참조 자료예요. verbose_response나 allowed_content_types 같은 필드가 어떤 역할을 하는지, 그리고 Kong 기본 검증기와 JSON Schema draft 버전 검증기를 어떻게 고르는지 설명해요. 요청 본문이나 헤더, 쿼리 파라미터가 스키마에 맞게 들어오는지 검사하는 정책을 실제로 설정할 때 이 문서를 옆에 두고 참고하면 좋아요

출처: 문서

본문

{
  "properties": {
    "config": {
      "type": "object",
      "properties": {
        "verbose_response": {
          "type": "boolean",
          "description": "If enabled, the policy returns more verbose and detailed validation errors.",
          "default": false
        },
        "content_type_parameter_validation": {
          "type": "boolean",
          "description": "Determines whether to enable parameters validation of request content-type.",
          "default": true
        },
        "body_schema": {
          "type": "string",
          "description": "The request body schema specification. One of `body_schema` or `parameter_schema` must be specified."
        },
        "allowed_content_types": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of allowed content types. The value can be configured with the `charset` parameter. For example, `application/json; charset=UTF-8`.",
          "default": [
            "application/json"
          ]
        },
        "version": {
          "type": "string",
          "enum": [
            "draft201909",
            "draft202012",
            "draft4",
            "draft6",
            "draft7",
            "kong"
          ],
          "description": "Which validator to use. Supported values are `kong` (default) for using Kong's own schema validator, or `draft4`, `draft7`, `draft201909`, and `draft202012` for using their respective JSON Schema Draft compliant validators.",
          "default": "kong"
        },
        "parameter_schema": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "explode": {
                "type": "boolean",
                "description": "Required when `schema` and `style` are set. When `explode` is `true`, parameter values of type `array` or `object` generate separate parameters for each value of the array or key-value pair of the map. For other types of parameters, this property has no effect."
              },
              "schema": {
                "type": "string",
                "description": "Required when `style` and `explode` are set. This is the schema defining the type used for the parameter. It is validated using `draft4` for JSON Schema draft 4 compliant validator. In addition to being a valid JSON Schema, the parameter schema MUST have a top-level `type` property to enable proper deserialization before validating."
              },
              "in": {
                "type": "string",
                "enum": [
                  "header",
                  "path",
                  "query"
                ],
                "description": "The location of the parameter."
              },
              "name": {
                "type": "string",
                "description": "The name of the parameter. Parameter names are case-sensitive, and correspond to the parameter name used by the `in` property. If `in` is `path`, the `name` field MUST correspond to the named capture group from the configured `route`."
              },
              "required": {
                "type": "boolean",
                "description": "Determines whether this parameter is mandatory."
              },
              "style": {
                "type": "string",
                "enum": [
                  "deepObject",
                  "form",
                  "label",
                  "matrix",
                  "pipeDelimited",
                  "simple",
                  "spaceDelimited"
                ],
                "description": "Required when `schema` and `explode` are set. Describes how the parameter value will be deserialized depending on the type of the parameter value."
              }
            },
            "required": [
              "in",
              "name",
              "required"
            ]
          },
          "description": "Array of parameter validator specification. One of `body_schema` or `parameter_schema` must be specified."
        }
      }
    }
  }
}

관련 리소스

더 알아보기 (Learn more)

  • OpenAPI 사양을 기준으로 요청과 응답을 검증하는 정책의 설정 방법을 담고 있어요 — OAS Validation Policy
  • WebSocket 메시지를 검증하는 정책의 구성 내용을 확인할 수 있어요 — WebSocket Validator Policy
  • AI 정책 엔터티의 구조와 설정 방식을 이해하는 데 도움이 돼요 — AI Policy entity