OAS 검증 플러그인 구성 참조
OAS 검증 플러그인 구성 참조 (OAS Validation Plugin Configuration Reference)
이 문서는 Kong Gateway의 OAS Validation 플러그인에서 설정할 수 있는 모든 구성 파라미터를 정리한 참조 자료예요. Swagger나 OpenAPI로 작성한 API 명세를 지정하는 방법부터 헤더 파라미터 검사, 경로 매칭 시 base path 포함 여부 같은 세부 옵션까지 항목별로 설명해요. 스키마 검증 오류를 첫 오류에서 멈추지 않고 모두 수집하는 옵션이나 구조화된 오류 개수 제한 같은 오류 처리 동작을 조정하는 설정도 함께 다뤄요. 각 파라미터의 기본값과 타입이 함께 표시되어 있어서 플러그인을 설정할 때 바로 참고하기 좋아요
출처: 문서
본문
{
"properties": {
"config": {
"properties": {
"allowed_header_parameters": {
"default": "Host,Content-Type,User-Agent,Accept,Content-Length",
"description": "List of header parameters in the request that will be ignored when performing HTTP header validation. These are additional headers added to an API request beyond those defined in the API specification. For example, you might include the HTTP header `User-Agent`, which lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent.",
"type": "string"
},
"api_spec": {
"description": "The API specification defined using either Swagger or the OpenAPI. This can be either a JSON or YAML based file. If using a YAML file, the spec needs to be URI-Encoded to preserve the YAML format.",
"type": "string"
},
"api_spec_encoded": {
"default": true,
"description": "Indicates whether the api_spec is URI-Encoded.",
"type": "boolean"
},
"collect_all_errors": {
"default": false,
"description": "If set to true, collects all schema validation errors instead of stopping at the first. Applies only to JSON Schema validation (parameter values, request/response body); pre-validation checks such as path-not-found, unsupported content-type, and unknown parameters are fail-fast and always stop at the first error regardless of this setting. Only takes effect when `structured_errors` is set to `false`. Note: Enabling this option will affect performance.",
"type": "boolean"
},
"custom_base_path": {
"description": "The base path to be used for path match evaluation. This value is ignored if `include_base_path` is set to `false`.",
"type": "string"
},
"header_parameter_check": {
"default": false,
"description": "If set to true, checks if HTTP header parameters in the request exist in the API specification.",
"type": "boolean"
},
"include_base_path": {
"default": false,
"description": "Indicates whether to include the base path when performing path match evaluation.",
"type": "boolean"
},
"max_structured_errors": {
"description": "When set, caps the number of structured errors returned in the `errors` array to the specified value (must be greater than 0). Applies only to JSON Schema validation errors; pre-validation failures such as path-not-found, unsupported content-type, and unknown parameters always produce a single error entry. When not set, no cap is applied. Requires `structured_errors` to be enabled.",
"type": "integer"
},
"notify_only_request_validation_failure": {
"default": false,
"description": "If set to true, notifications via event hooks are enabled, but request based validation failures don't affect the request flow.",
"type": "boolean"
},
"notify_only_response_body_validation_failure": {
"default": false,
"description": "If set to true, notifications via event hooks are enabled, but response validation failures don't affect the response flow.",
"type": "boolean"
},
"query_parameter_check": {
"default": false,
"description": "If set to true, checks if query parameters in the request exist in the API specification.",
"type": "boolean"
},
"rfc9457_error_response": {
"default": false,
"description": "If set to `true`, interrupting non-gRPC HTTP validation failures are returned as `application/problem+json` using RFC 9457 top-level fields plus Kong extensions `message`, `errors`, and optional `more`. Requires `structured_errors` and `verbose_response` to both be set to `true`. When set to `false`, the legacy response format is preserved.",
"type": "boolean"
},
"structured_errors": {
"default": false,
"description": "If set to true, schema validation failures are returned as a structured `errors` array, where each entry contains `instanceLocation`, `keywordLocation`, and `error`. Pre-validation failures such as path-not-found or unsupported content-type also return an `errors` array, but entries contain only an `error` field. Requires `verbose_response` to be enabled. Use `max_structured_errors` to cap the response size.",
"type": "boolean"
},
"validate_request_body": {
"default": true,
"description": "If set to true, validates the request body content against the API specification.",
"type": "boolean"
},
"validate_request_header_params": {
"default": true,
"description": "If set to true, validates HTTP header parameters against the API specification.",
"type": "boolean"
},
"validate_request_query_params": {
"default": true,
"description": "If set to true, validates query parameters against the API specification.",
"type": "boolean"
},
"validate_request_uri_params": {
"default": true,
"description": "If set to true, validates URI parameters in the request against the API specification.",
"type": "boolean"
},
"validate_response_body": {
"default": false,
"description": "If set to true, validates the response from the upstream services against the API specification. If validation fails, it results in an `HTTP 406 Not Acceptable` status code.",
"type": "boolean"
},
"verbose_response": {
"default": false,
"description": "If set to true, returns a detailed error message for invalid requests & responses. This is useful while testing.",
"type": "boolean"
}
},
"required": [
"api_spec"
],
"type": "object"
},
"consumer": {
"additionalProperties": false,
"description": "If set, the plugin will activate only for requests where the specified has been authenticated. (Note that some plugins can not be restricted to consumers this way.). Leave unset for the plugin to activate regardless of the authenticated Consumer.",
"properties": {
"id": {
"type": "string"
}
},
"type": "object"
},
"expressions": {
"additionalProperties": true,
"type": "object"
},
"protocols": {
"default": [
"grpc",
"grpcs",
"http",
"https"
],
"description": "A set of strings representing HTTP protocols.",
"items": {
"enum": [
"grpc",
"grpcs",
"http",
"https"
],
"type": "string"
},
"type": "array"
},
"route": {
"additionalProperties": false,
"description": "If set, the plugin will only activate when receiving requests via the specified route. Leave unset for the plugin to activate regardless of the route being used.",
"properties": {
"id": {
"type": "string"
}
},
"type": "object"
},
"service": {
"additionalProperties": false,
"description": "If set, the plugin will only activate when receiving requests via one of the routes belonging to the specified Service. Leave unset for the plugin to activate regardless of the Service being matched.",
"properties": {
"id": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"config"
]
}
관련 리소스
더 알아보기 (Learn more)
- Kong Gateway에서 특정 이벤트가 발생했을 때 웹훅 등으로 알림을 받을 수 있는 이벤트 훅 기능을 소개해요 — Event Hooks