mocking
The JSON schema supports the following types in their fields:
string
number
integer
boolean
object
array
Here is a JSON schema example:
{
"field1": 123.12,
"field3_2": {
"field3_2_1": true,
"field3_2_2": [
155,
155
]
}
},
"field0": "abcd",
"field2": [
"sC"
]
The example below configures the Plugin for a specific Route:
Once you have configured the Plugin as mentioned above, you can test the Route.
{
"delay":0,
"content_type":"",
"with_mock_header":true,
"response_status":201,
"response_example":"{\"a\":1,\"b\":2}"
}
Now to test the Route:
HTTP/1.1 201 Created
...
Content-Type: application/json;charset=utf8
x-mock-by: APISIX/2.10.0
...
To disable the mocking
Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.