Add swagger check (#3811)

This commit is contained in:
Antoine GIRARD 2018-04-20 11:13:50 +02:00 committed by Bo-Yi Wu
parent cf8c2e5951
commit 3506717e9c
13 changed files with 143 additions and 124 deletions

View file

@ -91,6 +91,15 @@ generate-swagger:
fi
swagger generate spec -o ./public/swagger.v1.json
.PHONY: swagger-check
swagger-check: generate-swagger
@diff=$$(git diff public/swagger.v1.json); \
if [ -n "$$diff" ]; then \
echo "Please run 'make generate-swagger' and commit the result:"; \
echo "$${diff}"; \
exit 1; \
fi;
.PHONY: errcheck
errcheck:
@hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
@ -288,7 +297,7 @@ generate-stylesheets:
.PHONY: swagger-ui
swagger-ui:
rm -Rf public/vendor/assets/swagger-ui
git clone --depth=10 -b v3.3.2 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui
git clone --depth=10 -b v3.13.4 --single-branch https://github.com/swagger-api/swagger-ui.git $(TMPDIR)/swagger-ui
mv $(TMPDIR)/swagger-ui/dist public/vendor/assets/swagger-ui
rm -Rf $(TMPDIR)/swagger-ui
$(SED_INPLACE) "s;http://petstore.swagger.io/v2/swagger.json;../../../swagger.v1.json;g" public/vendor/assets/swagger-ui/index.html