File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ all : openapi.json openapi.min.json
2+
3+ clean :
4+ rm -f * .json
5+
6+ # This is the "extract" set of endpoints
7+ openapi-extract.json :
8+ curl -o openapi-extract.json https://docs.diffbot.com/openapi/638975592e00230010aaaa39
9+
10+ # The verbatim OpenAPI spec has a couple of issues:
11+ #
12+ # * It uses version 3.1.0 of the OpenAPI standard, but tooling only supports 3.0.x
13+ # * Its array items schema types use array instead of object (no idea why)
14+ # * It has an incompletely-specified "/{api}" endpoint
15+ #
16+ # We use jq to clean these issues up.
17+ #
18+ # Also, we're only handling the "extract" OpenAPI spec at this time.
19+ openapi.json : openapi-extract.json
20+ cat openapi-extract.json | jq ' walk(if (.|type) == "object" and .items? and (.items|type) == "array" then .items = .items[0] else . end)|del(.paths["/{api}"])|.openapi="3.0.2"' > openapi.json
21+
22+ # Create a minified version, while we're in here
23+ openapi.min.json : openapi.json
24+ cat openapi.json | jq -c > openapi.min.json
25+
You can’t perform that action at this time.
0 commit comments