11# set user to "root" to run commands as root in docker
22USER =$$(whoami )
33# The docker command to execute commands directly in docker
4- DOCKER =docker-compose exec -T --user="$(USER ) " backend-php
4+ DOCKER =docker-compose exec -T -w /app - -user="$(USER ) " backend-php
55# The PHP binary to use, you may add arguments to PHP here
66PHP =php
77# directories writeable by webserver
@@ -20,9 +20,10 @@ default:
2020 @echo " make stop-docker stop docker environment"
2121 @echo " make cli run bash in docker environment"
2222 @echo " make bash alias for 'make cli'"
23+ @echo " make lint Run OpenAPI linter"
2324
2425
25- .PHONY : start stop start-docker stop-docker clean test bash cli
26+ .PHONY : start stop start-docker stop-docker clean test bash cli lint lint-php lint-js
2627
2728
2829# # PHP runtime ##
@@ -81,6 +82,19 @@ backend/config/cookie-validation.key:
8182 test -s $@ || php -r ' echo bin2hex(random_bytes(20));' > $@
8283
8384
85+ # Lint API spec
86+ 87+ lint : lint-php lint-js
88+ 89+ lint-php :
90+ $(DOCKER ) ./vendor/bin/php-openapi validate openapi/schema.yaml
91+ 92+ lint-js : node_modules/.bin/spectral
93+ docker-compose run -T --no-deps --rm --user=" $$ (id -u)" -e FORCE_COLOR=1 -w /app nodejs ./node_modules/.bin/spectral lint openapi/schema.yaml -f stylish --ruleset .spectral.yml
94+ 95+ node_modules/.bin/spectral : package.json
96+ docker-compose run -T --no-deps --rm --user=" $$ (id -u)" -e FORCE_COLOR=1 -w /app nodejs npm install
97+ 8498# # Docker Runtime Tests ##
8599
86100test : tests/_data/dump.sql
0 commit comments