모킹 플러그인 구성 참조
모킹 플러그인 구성 참조 (Mocking Plugin Configuration Reference)
이 문서는 Kong의 Mocking 플러그인에서 설정할 수 있는 파라미터들을 하나씩 정리해 놓은 구성 참조 자료예요. API 명세를 설정에 직접 넣는 방법과 데이터베이스에 저장된 명세 파일을 쓰는 방법의 차이, 그리고 하이브리드나 DB-less 모드에서 어떤 옵션을 사용해야 하는지도 설명해 줘요. random_delay나 random_status_code처럼 모의 응답에 무작위 지연을 추가하거나 상태 코드를 선택하는 옵션들이 기본값과 함께 정리되어 있으니, 플러그인을 설정하기 전에 참고하면 좋아요
출처: 문서
본문
{
"properties": {
"config": {
"properties": {
"api_specification": {
"description": "The contents of the specification file. You must use this option for hybrid or DB-less mode. You can include the full specification as part of the configuration. In Kong Manager, you can copy and paste the contents of the spec directly into the `Config.Api Specification` text field.",
"type": "string"
},
"api_specification_filename": {
"description": "The path and name of the specification file loaded into Kong Gateway's database. You cannot use this option for DB-less or hybrid mode.",
"type": "string"
},
"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"
},
"include_base_path": {
"default": false,
"description": "Indicates whether to include the base path when performing path match evaluation.",
"type": "boolean"
},
"included_status_codes": {
"description": "A global list of the HTTP status codes that can only be selected and returned.",
"items": {
"type": "integer"
},
"type": "array"
},
"max_delay_time": {
"default": 1,
"description": "The maximum value in seconds of delay time. Set this value when `random_delay` is enabled and you want to adjust the default. The value must be greater than the `min_delay_time`.",
"type": "number"
},
"min_delay_time": {
"default": 0.001,
"description": "The minimum value in seconds of delay time. Set this value when `random_delay` is enabled and you want to adjust the default. The value must be less than the `max_delay_time`.",
"type": "number"
},
"random_delay": {
"default": false,
"description": "Enables a random delay in the mocked response. Introduces delays to simulate real-time response times by APIs.",
"type": "boolean"
},
"random_examples": {
"default": false,
"description": "Randomly selects one example and returns it. This parameter requires the spec to have multiple examples configured.",
"type": "boolean"
},
"random_status_code": {
"default": false,
"description": "Determines whether to randomly select an HTTP status code from the responses of the corresponding API method. The default value is `false`, which means the minimum HTTP status code is always selected and returned.",
"type": "boolean"
}
},
"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)
- Kong Gateway에서 DNS를 구성하는 방법을 항목별로 정리한 참조 문서예요 — DNS configuration reference
- Insomnia의 목 서버 기능을 소개하는 문서로, Mocking 플러그인과 함께 API를 모의 테스트할 때 유용해요 — Insomnia mock servers