Express Gateway OpenAPI 3 Mock Server Plugin
This plugin is under active development. Would you meet any problems, please open a new issue after verifying that there isn't one already.
Prerequisites
Please follow the instructions on Express Gateway's Getting started page.
Also please take a look at how plugins are installed and enabled.
Installation
eg plugin install express-gateway-plugin-openapi3-mock-server
Configuration
You can use samples/base-paths.yml
for testing purposes. If so, please create a definitions
folder
in the project root and copy the sample YAML there.
system.config.yml
# some config in front of the plugins section plugins: express-gateway-plugin-openapi3-mock-server: definitionFile: 'definitions/yourdefinition.yml' # The file containing your API's specification # some config after the plugins section
gateway.config.yml (A barebone example, if nothing else is used.)
http: port: 80apiEndpoints: api: host: '*'policies: - mockpipelines: api: apiEndpoints: - api policies: - mock: - action
The above configuration disables the Admin CLI and will do nothing but provide a dummy responder based on your OpenAPI specification.
Features
- Endpoints with appropriate request types are parsed and the first response example is used as a response body.
- HTTP and apiKey auth header check support
To do
- Accept header checks to return appropriate response example
- X-* headers for testing error responses
- X-* headers for response example selection
- Input parameter validation
- Generators for random response data based on provided schema