Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/en/latest/plugins/elasticsearch-logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
"elasticsearch-logger": {
"endpoint_addrs": ["http://elasticsearch:9200"],
"field": {
"index": "gateway",
"index": "gateway"
}
}
},
Expand Down Expand Up @@ -288,7 +288,7 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
"elasticsearch-logger": {
"endpoint_addrs": ["http://elasticsearch:9200"],
"field": {
"index": "gateway",
"index": "gateway"
},
"include_req_body": true,
"include_req_body_expr": [["arg_log_body", "==", "yes"]]
Expand Down
4 changes: 2 additions & 2 deletions docs/en/latest/plugins/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ The `mocking` Plugin allows you to simulate API responses without forwarding req
| delay | integer | False | 0 | Response delay in seconds. |
| response_status | integer | False | 200 | HTTP status code of the response. |
| content_type | string | False | application/json;charset=utf8 | `Content-Type` header value of the response. |
| response_example | string | One of this or `response_schema` | | Body of the response. Supports [NGINX variables](https://nginx.org/en/docs/http/ngx_http_core_module.html), such as `$remote_addr`. One of `response_example` or `response_schema` must be configured, and they must not be configured together. |
| response_schema | object | One of this or `response_example` | | A [JSON schema](https://json-schema.org) object to generate a random mock response body. One of `response_schema` or `response_example` must be configured, and they must not be configured together. |
| response_example | string | One of this or `response_schema` | | Body of the response. Supports [NGINX variables](https://nginx.org/en/docs/http/ngx_http_core_module.html), such as `$remote_addr`. At least one of `response_example` or `response_schema` must be configured. If both are configured, `response_example` takes precedence and `response_schema` is ignored. |
| response_schema | object | One of this or `response_example` | | A [JSON schema](https://json-schema.org) object to generate a random mock response body. At least one of `response_schema` or `response_example` must be configured. If both are configured, `response_example` takes precedence and `response_schema` is ignored. |
| with_mock_header | boolean | False | true | When set to `true`, adds a response header `x-mock-by: APISIX/{version}`. |
| response_headers | object | False | | Headers to be added in the mocked response. For example: `{"X-Foo": "bar"}`. |

Expand Down
4 changes: 2 additions & 2 deletions docs/zh/latest/plugins/elasticsearch-logger.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
"elasticsearch-logger": {
"endpoint_addrs": ["http://elasticsearch:9200"],
"field": {
"index": "gateway",
"index": "gateway"
}
}
},
Expand Down Expand Up @@ -289,7 +289,7 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
"elasticsearch-logger": {
"endpoint_addrs": ["http://elasticsearch:9200"],
"field": {
"index": "gateway",
"index": "gateway"
},
"include_req_body": true,
"include_req_body_expr": [["arg_log_body", "==", "yes"]]
Expand Down
6 changes: 3 additions & 3 deletions docs/zh/latest/plugins/mocking.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ description: mocking 插件无需转发请求到上游服务即可模拟 API 响
| delay | integer | 否 | 0 | 延迟返回响应的时间,单位为秒。 |
| response_status | integer | 否 | 200 | 响应的 HTTP 状态码。 |
| content_type | string | 否 | application/json;charset=utf8 | 响应的 `Content-Type` 标头值。 |
| response_example | string | 二选一 | | 响应体内容。支持 [NGINX 变量](https://nginx.org/en/docs/http/ngx_http_core_module.html),例如 `$remote_addr`。与 `response_schema` 二选一,且至少配置其中一个,不能同时配置。 |
| response_schema | object | 二选一 | | 用于生成随机模拟响应体的 [JSON Schema](https://json-schema.org) 对象。与 `response_example` 二选一,且至少配置其中一个,不能同时配置。 |
| response_example | string | 二选一 | | 响应体内容。支持 [NGINX 变量](https://nginx.org/en/docs/http/ngx_http_core_module.html),例如 `$remote_addr`。`response_example` 与 `response_schema` 至少配置其中一个;若同时配置,以 `response_example` 为准,`response_schema` 将被忽略。 |
| response_schema | object | 二选一 | | 用于生成随机模拟响应体的 [JSON Schema](https://json-schema.org) 对象。`response_schema` 与 `response_example` 至少配置其中一个;若同时配置,以 `response_example` 为准,`response_schema` 将被忽略。 |
| with_mock_header | boolean | 否 | true | 设置为 `true` 时,将添加响应头 `x-mock-by: APISIX/{version}`。 |
| response_headers | object | 否 | | 要添加到模拟响应中的标头。例如:`{"X-Foo": "bar"}`。 |

:::note
`response_example` `response_schema` 不能同时配置,且至少需要配置其中一个,否则插件配置将无法通过校验。
必须配置 `response_example` `response_schema` 其中之一,否则插件配置将无法通过校验;若同时配置,以 `response_example` 为准,`response_schema` 将被忽略
:::

`response_schema` 支持以下字段类型:
Expand Down
Loading