Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Szasza/express-gateway-plugin-openapi3-mock-server

Repository files navigation

Express Gateway OpenAPI 3 Mock Server Plugin

npm version

DEPRECATION NOTICE Following the main Express Gateway's deprecation, this project is no longer maintained.

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: 80
apiEndpoints:
  api:
    host: '*'
policies:
  - mock
pipelines:
  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

About

An OpenAPI 3 mock server plugin for Express Gateway

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published