Request Validator 플러그인 구성 레퍼런스
Request Validator 플러그인 구성 레퍼런스 (Request Validator Plugin Configuration Reference)
이 문서는 Kong의 Request Validator 플러그인에서 설정할 수 있는 구성 옵션을 스키마 형태로 정리해 놓은 참조 자료예요. 허용할 콘텐츠 타입, 요청 본문 스키마, 파라미터 검증 규칙 같은 각 필드의 의미와 기본값을 하나씩 설명해 줘요. 검증에 실패한 요청을 차단할지 로그만 남길지 결정하는 enforcement_mode 같은 핵심 동작 설정도 함께 확인할 수 있어요. 요청 검증 규칙을 세밀하게 조정하고 싶을 때 이 레퍼런스를 옆에 두고 보면 좋아요
출처: 문서
본문
{
"properties": {
"config": {
"properties": {
"allowed_content_types": {
"default": [
"application/json"
],
"description": "List of allowed content types. The value can be configured with the `charset` parameter. For example, `application/json; charset=UTF-8`.",
"items": {
"type": "string"
},
"type": "array"
},
"array_length_compat": {
"default": true,
"description": "If true, `minLength`/`maxLength` also apply to arrays using item count. Compatibility option for legacy schemas that use these keywords instead of `minItems`/`maxItems`.",
"type": "boolean"
},
"body_schema": {
"description": "The request body schema specification. One of `body_schema` or `parameter_schema` must be specified.",
"type": "string"
},
"content_type_parameter_validation": {
"default": true,
"description": "Determines whether to enable parameters validation of request content-type.",
"type": "boolean"
},
"enforcement_mode": {
"default": "block",
"description": "Determines the action to take when a request fails validation. When set to `block`, the request is rejected with an HTTP 400 response. When set to `log_only`, the request is allowed to proceed and a warning is logged.",
"enum": [
"block",
"log_only"
],
"type": "string"
},
"parameter_schema": {
"description": "Array of parameter validator specification. One of `body_schema` or `parameter_schema` must be specified.",
"items": {
"properties": {
"explode": {
"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.",
"type": "boolean"
},
"in": {
"description": "The location of the parameter.",
"enum": [
"header",
"path",
"query"
],
"type": "string"
},
"name": {
"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`.",
"type": "string"
},
"required": {
"description": "Determines whether this parameter is mandatory.",
"type": "boolean"
},
"schema": {
"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.",
"type": "string"
},
"style": {
"description": "Required when `schema` and `explode` are set. Describes how the parameter value will be deserialized depending on the type of the parameter value.",
"enum": [
"deepObject",
"form",
"label",
"matrix",
"pipeDelimited",
"simple",
"spaceDelimited"
],
"type": "string"
}
},
"required": [
"in",
"name",
"required"
],
"type": "object"
},
"type": "array"
},
"verbose_response": {
"default": false,
"description": "If enabled, the plugin returns more verbose and detailed validation errors.",
"type": "boolean"
},
"version": {
"default": "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.",
"enum": [
"draft201909",
"draft202012",
"draft4",
"draft6",
"draft7",
"kong"
],
"type": "string"
}
},
"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"
}
}
}
관련 리소스
더 알아보기 (Learn more)
- OpenAPI 스펙 기반으로 요청을 검증하는 플러그인이라 Request Validator와 함께 비교해 보면 이해에 도움이 돼요 — OAS Validation plugin
- WebSocket 통신에 대한 검증을 담당하는 플러그인으로, 유사한 검증 구성 개념을 참고할 수 있어요 — WebSocket Validator plugin