Skip to content

Commit 6914fcb

Browse files
committed
DOC-14186: Public spec for the Sync Gateway REST APIs (#963)
* Remove legacy OpenAPI specs * Remove unused models * Move overlays to attachments * Move bundles to hidden bld directory * Move overlaid specs to attachments * Add service-desc attributes * Update configuration schema template blocks * Remove adoc yaml parser * Remove links to client app page * Move Prometheus metrics source file to partials dir * Add metrics metadata schema file to attachments * Move generated HTML partials to REST API module * Update redocly theme * Update generate docs script * Update preview config * Rebuild output docs — includes 4.0.1 backport
1 parent a5fae87 commit 6914fcb

48 files changed

Lines changed: 50398 additions & 33689 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
set -exuo pipefail
44

5-
cd $(dirname "${BASH_SOURCE[0]}")
6-
75
GIT_ROOT=$(git rev-parse --show-toplevel)
86
cd "${GIT_ROOT}"
97

@@ -27,19 +25,17 @@ git reset --hard ${tag}
2725
cd ..
2826

2927
PATH_TO_SYNC_GATEWAY="${GIT_ROOT}/sync_gateway"
28+
PATH_TO_REDOCLY="${GIT_ROOT}/redocly"
3029

31-
PATH_TO_BUNDLE="${GIT_ROOT}/modules/ROOT/assets/attachments"
32-
PATH_TO_OVERLAY="${GIT_ROOT}/modules/ROOT/assets/overlays"
33-
PATH_TO_TEMP="${GIT_ROOT}/modules/ROOT/assets/bld"
30+
PATH_TO_ASSETS="${GIT_ROOT}/modules/rest-api/attachments"
31+
PATH_TO_PARTIALS="${GIT_ROOT}/modules/rest-api/partials"
32+
PATH_TO_TEMP="${GIT_ROOT}/modules/rest-api/bld"
3433
PATH_TO_STATIC="${GIT_ROOT}/modules/ROOT/partials/static_restapi"
34+
PATH_TO_METRICS="${GIT_ROOT}/modules/manage/partials"
3535

3636
# Create a bld directory to hold temporary files, if it doesn't already exist
3737
[[ -d "${PATH_TO_TEMP}" ]] || mkdir "${PATH_TO_TEMP}"
3838

39-
cat "${PATH_TO_BUNDLE}/metrics_metadata.json"
40-
jq . "${PATH_TO_BUNDLE}/metrics_metadata.json"
41-
jq --version
42-
4339
# Use jq to transform the Prometheus metrics file into JSON schema.
4440
# Temporarily omitting the description until we can sort out Redocly CSS issues.
4541
# Should be {"type": "integer", "format": .value.type, "description": .value.help}
@@ -48,10 +44,8 @@ npx --yes node-jq 'to_entries |
4844
map(.value |= del(.added, .labels, .unit, .stability, .help)) |
4945
from_entries |
5046
{type: "object", properties: .}' \
51-
"${PATH_TO_BUNDLE}/metrics_metadata.json" \
52-
> "${PATH_TO_TEMP}/metrics_metadata.json"
53-
54-
cd modules/ROOT
47+
"${PATH_TO_METRICS}/metrics_metadata.json" \
48+
> "${PATH_TO_ASSETS}/metrics_metadata.json"
5549

5650
generate() {
5751
WHAT=$1
@@ -61,28 +55,28 @@ generate() {
6155
--config "${PATH_TO_SYNC_GATEWAY}/.redocly.yaml" \
6256
"${WHAT}" \
6357
--dereferenced \
64-
--output "${PATH_TO_BUNDLE}/bundled-${WHAT}.yaml"
58+
--output "${PATH_TO_TEMP}/${WHAT}.bundle.yaml"
6559

6660
# Get the bundled spec, apply the OpenAPI overlay,
67-
# and output to the temporary bld folder.
61+
# and output to the attachments folder.
6862
npx --yes openapi-overlays-js \
69-
--openapi "${PATH_TO_BUNDLE}/bundled-${WHAT}.yaml" \
70-
--overlay "${PATH_TO_OVERLAY}/${WHAT}.yaml" \
71-
> "${PATH_TO_TEMP}/${WHAT}.yaml"
63+
--openapi "${PATH_TO_TEMP}/${WHAT}.bundle.yaml" \
64+
--overlay "${PATH_TO_ASSETS}/_${WHAT}.overlay.yaml" \
65+
> "${PATH_TO_ASSETS}/${WHAT}.overlaid.yaml"
7266

7367
# Build the reference documentation using the overlaid spec.
7468
npx --yes @redocly/cli \
7569
build-docs \
76-
--config redocly.yaml \
77-
"${PATH_TO_TEMP}/${WHAT}.yaml" \
78-
--output partials/sgw-openapi-$WHAT.html \
79-
--template partials/redocAll.hbs
70+
--config "${PATH_TO_REDOCLY}/theme.yaml" \
71+
"${PATH_TO_ASSETS}/${WHAT}.overlaid.yaml" \
72+
--output "${PATH_TO_PARTIALS}/sgw-openapi-$WHAT.html" \
73+
--template "${PATH_TO_PARTIALS}/redocAll.hbs"
8074

8175
# Build the static output using the overlaid spec.
8276
npx --yes @openapitools/openapi-generator-cli generate \
8377
--skip-validate-spec \
8478
--generator-name asciidoc \
85-
--input-spec "${PATH_TO_TEMP}/${WHAT}.yaml" \
79+
--input-spec "${PATH_TO_ASSETS}/${WHAT}.overlaid.yaml" \
8680
--template-dir "${PATH_TO_STATIC}/templates" \
8781
--additional-properties skipExamples=true \
8882
--output "${PATH_TO_STATIC}/${WHAT}"

modules/ROOT/assets/attachments/README.adoc

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)