Validating REST API proxy
Vrap is a validating REST API proxy. In order to be able to validate rest api calls the proxy consumes RAML 1.0 definition files.
The easisest way is to start vrap with docker. This requires that you have docker docker installed on your system. When docker is started, you can run vrap with the following command:
docker run -v<RAML-definition-directory>:/api -p5050:5050 vrapio/vrap /api/api.raml
Vrap provides two modes of operation, which can be set globally on the command line (via the -m mode cli option) or set for a request with the X-Vrap-Mode http header.
A short introduction to using vrap is available at tutorial .
The behaviour of vrap can be controlled by adding the following headers to the request:
X-Vrap-Mode sets the vrap mode for the request
Value | Description |
---|---|
example | sends the raml definition example that matches the request |
proxy | proxy the request to the base uri given in the raml definition |
X-Vrap-Disable-Validation disables the validation. You can set multiple values for this header:
Value | Description |
---|---|
request | disable request body validation |
queryParameter | disable query parameter validation |
header | disable request header validation |
response | disable received response body validation |
usage: vrap [OPTIONS] <file.raml>
-a,--api <api> URI to proxy to
-d,--duplicate-detection <bool> Enable duplicate key detection
-dr,--dry-run Report errors only
-h,--help display help
-m,--mode <mode> vrap mode: [example, proxy]
-p,--port <port> port to listen for requests
-s,--pool-size <pool-size> Size of the http client connection pool
-ssl <mode> SSL verification mode: [normal, insecure]
The source code is available from our github repository vrapio/vrap, which contains a Readme.md file with build instructions.
This project is friendly supported by JetBrains & IntelliJ IDEA!