Sign inSign up

marciocamurati/swagger-api-mock

By marciocamurati

•Updated over 9 years ago

Refactor (http://dockr.ly/2r6PPjJ) to use this version (http://bit.ly/2r7cA71) with cors fix.

Image
0

928

marciocamurati/swagger-api-mock repository overview

⁠swagger api mock server

Runs an api mock server, by parsing a swagger.yml file. You can edit the swagger.yml, reload the browser and everything should be up-to-date.

⁠how to run

The -i is important for the ctrl-c command to be send to grunt.

⁠just to take a look

docker run -i \
    -p 8000:8000 \
    -t palo/swagger-api-mock

⁠with your swagger.yml

You need a folder where your swagger.yml is placed. It has to be named swagger.yml.

docker run -i \
    -p 8000:8000 \
    -v /path/to/folder:/data \
    -t palo/swagger-api-mock

If you need to specify a different name for YAML file you can mount a volume like the following:

docker run -i \
    -p 8000:8000 \
    -v /path/to/file.yaml:/data/swagger.yml \
    -t palo/swagger-api-mock

⁠CORS support

HTTP headers for Cross-Origin Resource Sharing (CORS) are automatically set to allow any kind of access. All preflight or normal requests will be automatically served with the following values:

HeaderValue
Access-Control-Allow-OriginIf the HTTP request includes an Origin header, then this value is echoed back; otherwise value is a wildcard *
Access-Control-Allow-CredentialsIf the Access-Control-Allow-Origin is a wildcard * value is false; otherwise true.
Access-Control-Allow-MethodsAll HTTP methods are always sent.
Access-Control-Allow-HeadersIf the HTTP request includes an Access-Control-Request-Headers header, then this value is echoed back; otherwise it is not set.

Please note that preflight requests (with OPTIONS method) will be always forced to HTTP code 200, even if not declared in YAML file.

Tag summary

Content type

Image

Digest

Size

269.8 MB

Last updated

over 9 years ago

docker pull marciocamurati/swagger-api-mock