openapi-contract-validator-server
v0.2.0
Published
Use an HTTP proxy to validate HTTP interactions against an OpenAPI Schema
Maintainers
Readme
OpenAPI Contract validator server
Validate HTTP interactions against an OpenAPI Schema via an HTTP proxy.
Installation
npm install -g openapi-contract-validator-serverGetting started
Make sure you've installed the package like described above.
You'll need a few config files. Open a command line in the folder you want to store the config files and execute:
openapi-contract-validator-server initA few files have been generated for you:
endpoints.jsis the place where you'll define all your endpoints and their corresponding contractsopenapi-contract-validator-server.config.jsis the place where you can configure the server itself
All files contain default values. You can now start the server:
openapi-contract-validator-server startMake a request to http://localhost:3000/ to see the server work.
Command line interface
> openapi-contract-validator-server --help
Usage: openapi-contract-validator-server <command> [options]
Options:
-V, --version output the version number
-h, --help display help for command
Commands:
start [options] Start a OpenAPI Schema validation proxy server.
init Copy default configuration to get started quickly
help [command] display help for commandstart
You can overwrite some bits of server configuration by supplying them as command line flags.
> openapi-contract-validator-server start --help
Usage: openapi-contract-validator-server start [options]
Start a OpenAPI Schema validation proxy server.
Options:
-p, --port <port number> Start the server on this port
-t, --target <url> Target base URL
-l, --log <depth> Numeric level of log detail
-c, --config-file <path> Path to the config file that should be used
-h, --help display help for commandopenapi-contract-validator-server start --target http://localhost:4200 -l 2Contributing
Contributors are always welcome! I really don't care if you are a beginner or an expert, all help is welcome. Help includes code contributions, fixing one of my many typos, helping others, etc.
