Sign inSign up

palo/swagger-api-mock

By palo

•Updated over 9 years ago

Runs an api mock server, by parsing a swagger.yaml file

Image
7

10K+

palo/swagger-api-mock repository overview

⁠swagger api mock server

Runs an api mock server, by parsing a swagger.yaml file. You can edit the swagger.yaml, 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.yaml

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

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.yaml \
    -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

263.9 MB

Last updated

over 9 years ago

docker pull palo/swagger-api-mock