danielgtaylor / apisprout

Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation
MIT License
697 stars 74 forks source link

Add support for watching multiple files (or wildcard) with --watch option #33

Open AbhimanyuG opened 5 years ago

AbhimanyuG commented 5 years ago

It'll be helpful if specs are distributed across multiple files.

Something like:

apisprout --watch /api-specs/*.yaml
danielgtaylor commented 5 years ago

Nice idea! This might also be possible by parsing the refs in the file, which would mean supporting watching files across different directories instead of assuming all the files are in one place.

AbhimanyuG commented 5 years ago

Nice idea! This might also be possible by parsing the refs in the file, which would mean supporting watching files across different directories instead of assuming all the files are in one place.

Yea, that makes more sense.

For anyone looking for workaround right now, here's a pm2 wrapper Dockerfile and command:

Dockerfile:

FROM danielgtaylor/apisprout
RUN apk update && apk add nodejs npm && npm i -g pm2

docker-compose.yml

 api-mock:
    build: ./dir
    volumes:
      - "./dir:/api-specs"
    entrypoint: "pm2 start apisprout --no-daemon --watch /api-specs/ -- /api-specs/openapi.yaml"