-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (24 loc) · 985 Bytes
/
Makefile
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
all: openapi.json openapi.min.json
clean:
rm -f *.json
# This is the "extract" set of endpoints.
#
# For the curious, this URL was pulled from
# https://docs.diffbot.com/openapi. It's not hard to see how
# additional parts of the OpenAPI spec could be similarly extracted.
openapi-extract.json:
curl -o openapi-extract.json https://docs.diffbot.com/openapi/638975592e00230010aaaa39
# The verbatim OpenAPI spec has a couple of issues:
#
# * It uses version 3.1.0 of the OpenAPI standard, but tooling only supports 3.0.x
# * Its array items schema types use array instead of object (no idea why)
# * It has an incompletely-specified "/{api}" endpoint
#
# We use jq to clean these issues up.
#
# Also, we're only handling the "extract" OpenAPI spec at this time.
openapi.json: openapi-extract.json
cat openapi-extract.json | jq -f extract.jq >openapi.json
# Create a minified version, while we're in here
openapi.min.json: openapi.json
cat openapi.json | jq -c >openapi.min.json