-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate_openapi.sh
executable file
·32 lines (25 loc) · 1.09 KB
/
update_openapi.sh
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
#!/bin/bash
# (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Find all blueprint-specs.
BP_SPECS=$(cd backend/pine/backend && find . -name 'openapi.yaml' | grep -v './api/openapi.yaml' | sort | awk '{print "/local/" $0}')
set -ex
# Join them into one.
docker run --rm \
-v "${DIR}/backend/pine/backend:/local:rw" \
-w /local/api \
redocly/openapi-cli join \
/local/api/base.yaml \
${BP_SPECS}
# Dereference and lint.
docker run --rm -v "${DIR}/backend/pine/backend:/local:rw" redocly/openapi-cli bundle \
--lint \
--dereferenced \
--output /local/api/openapi.yaml \
/local/api/openapi.yaml
# docker run --rm -v "${DIR}/backend/pine/backend:/local:rw" openapitools/openapi-generator-cli generate \
# -g openapi-yaml \
# -i /local/api/openapi.yaml -o /local/api \
# --additional-properties outputFile=openapi.yaml \
# $@
sed -i '1i # (C) 2021 The Johns Hopkins University Applied Physics Laboratory LLC.\n' ${DIR}/backend/pine/backend/api/openapi.yaml