Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add openapi_diff to travis #25

Merged
merged 1 commit into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/diff_spec.sh → .ci/json_diff.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
diff=$(jsondiff openapi.json local_openapi.json);

if [ ! "$diff" = "{}" ]; then
echo -e "Generated OpenAPI spec did not match committed version. Diff:\n$diff";
exit 1;
Expand Down
3 changes: 3 additions & 0 deletions .ci/openapi_diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# Note: This returns exit code 0, if the two specs agree, otherwise exit code 1
docker run -t -v $(pwd):/specs:ro quen2404/openapi-diff /specs/openapi.json /specs/local_openapi.json
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
services:
- mongodb
- docker
language: python
python:
- "3.6"
install:
- pip install -e .
- pip install -r requirements.txt
- pip install -r requirements-optional.txt
- docker pull quen2404/openapi-diff
script:
- pytest
- openapi-spec-validator openapi.json
# start server to generate schema then kill it
- timeout 2 ./run.sh; if [ $? -eq 124 ]; then return 0; else return 1; fi
# check whether generated schema matches the committed version
- .ci/diff_spec.sh
- .ci/openapi_diff.sh