Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.DEFAULT_GOAL := validate-build
.PHONY: install print-version bundle validate validate-build bundle-dereferenced spectral
# The standard @apidevtools/swagger-cli does NOT install @apidevtools/swagger-parser > 10.1.0 which
# is required for OpenAPI version 3.1.0. But there is a branch from JonasGroeger that fixes that.
# Once upstream updates their dependencies (see https://github.com/APIDevTools/swagger-cli/pull/78)
# we can remove this install target and use
# npm install -g @apidevtools/swagger-cli
# again.
install:
git clone https://github.com/JonasGroeger/swagger-cli.git /tmp/swagger-cli
cd /tmp/swagger-cli && npm install && sudo npm install -g
chmod +x /tmp/swagger-cli/bin/swagger-cli.js
/tmp/swagger-cli/bin/swagger-cli.js --version
print-version:
swagger-cli --version
bundle: print-version
swagger-cli bundle \
--type yaml \
--outfile dist/submission-api.yaml \
spec/submission-api.yaml
validate: print-version
swagger-cli validate spec/submission-api.yaml
validate-build: bundle
swagger-cli validate dist/submission-api.yaml
bundle-dereferenced: print-version
swagger-cli bundle \
--type yaml \
--outfile dist/submission-api.yaml \
--dereference \
spec/submission-api.yaml
pwd := $(shell pwd)
spectral: bundle
docker run --rm --pull=always \
-v "$(pwd):/work" -w /work \
stoplight/spectral:6 lint spec/submission-api.yaml -D