-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comparison tests for index_openapi.json. Update pre-commit to perform tests as well.
- Loading branch information
Showing
6 changed files
with
2,109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/index_openapi.json /specs/local_index_openapi.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
#!/bin/bash | ||
diff=$(jsondiff openapi.json local_openapi.json); | ||
index_diff=$(jsondiff index_openapi.json local_index_openapi.json); | ||
|
||
if [ ! "$diff" = "{}" ]; then | ||
echo -e "Generated OpenAPI spec did not match committed version. Diff:\n$diff"; | ||
echo -e "Generated OpenAPI spec for test server did not match committed version. Diff:\n$diff"; | ||
exit 1; | ||
fi | ||
|
||
if [ ! "$index_diff" = "{}" ]; then | ||
echo -e "Generated OpenAPI spec for Index meta-database did not match committed version. Diff:\n$index_diff"; | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,17 @@ | ||
default_language_version: | ||
python: python3.7 | ||
|
||
repos: | ||
- repo: https://github.com/ambv/black | ||
rev: stable | ||
hooks: | ||
- id: black | ||
default_language_version: | ||
python: python3.7 | ||
name: Blacken | ||
|
||
- repo: local | ||
hooks: | ||
- id: json-diff | ||
name: OpenAPI diff | ||
description: Check for differences in openapi.json and index_openapi.json with local versions. | ||
entry: ./.ci/json_diff.sh | ||
language: system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.