Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc improvements for OSx unit tests and request validation plugin #1926

Merged
merged 1 commit into from
Jul 30, 2020
Merged
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
14 changes: 11 additions & 3 deletions doc/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,20 @@ Makefile rules:
* Run the test cases: `make test`
* To set the path of nginx to run the test cases: `TEST_NGINX_BINARY=/usr/local/bin/openresty prove -Itest-nginx/lib -r t`

### Troubleshoot
### Troubleshoot Testing

If you run in to an issue `Error unknown directive "lua_package_path" in /API_ASPIX/incubator-apisix/t/servroot/conf/nginx.conf`
**Set Nginx Path**
- If you run in to an issue `Error unknown directive "lua_package_path" in /API_ASPIX/incubator-apisix/t/servroot/conf/nginx.conf`
make sure to set openresty as default nginx. And export the path as below.

* export PATH=/usr/local/openresty/nginx/sbin:$PATH
- Linux default installation path:
* export PATH=/usr/local/openresty/nginx/sbin:$PATH
- OSx default installation path via homebrew:
* export PATH=/usr/local/opt/openresty/nginx/sbin:$PATH

**Run Individual Test Cases**
- Use the following command to run test cases constratined to a file:
- prove -Itest-nginx/lib -r t/plugin/openid-connect.t

## 5. Update Admin API token to protect Apache APISIX

Expand Down
60 changes: 32 additions & 28 deletions doc/plugins/request-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f13

**Using ENUMS:**

```shell
"body_schema": {
"type": "object",
"required": ["required_payload"],
"properties": {
"emum_payload": {
"type": "string",
enum: ["enum_string_1", "enum_string_2"]
default = "enum_string_1"
```json
{
"body_schema": {
"type": "object",
"required": ["required_payload"],
"properties": {
"emum_payload": {
"type": "string",
"enum": ["enum_string_1", "enum_string_2"],
"default": "enum_string_1"
}
}
}
}
Expand All @@ -124,25 +126,27 @@ curl http://127.0.0.1:9080/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f13

**JSON with multiple levels:**

```shell
"body_schema": {
"type": "object",
"required": ["required_payload"],
"properties": {
"boolean_payload": {"type": "boolean"},
"child_element_name": {
"type": "object",
"properties": {
"http_statuses": {
"type": "array",
"minItems": 1,
"items": {
"type": "integer",
"minimum": 200,
"maximum": 599
},
"uniqueItems": true,
"default": [200, 201, 202, 203]
```json
{
"body_schema": {
"type": "object",
"required": ["required_payload"],
"properties": {
"boolean_payload": {"type": "boolean"},
"child_element_name": {
"type": "object",
"properties": {
"http_statuses": {
"type": "array",
"minItems": 1,
"items": {
"type": "integer",
"minimum": 200,
"maximum": 599
},
"uniqueItems": true,
"default": [200, 201, 202, 203]
}
}
}
}
Expand Down