Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docss 1672 replace snippet enricher #9186

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions scripts/build_api_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ build_api_v2() {
cd src-api;
echo "Fetching OpenAPI spec."
curl https://circleci.com/api/v2/openapi.json > openapi.json
echo "Adding code samples to openapi.json spec."
./node_modules/.bin/snippet-enricher-cli --targets="node_request,python_python3,go_native,shell_curl" --input=openapi.json > openapi-with-examples.json
echo "Merging in JSON patches to correct and augment the OpenAPI spec."
jq -s '.[0] * .[1]' openapi-with-examples.json openapi-patch.json > openapi-patched.json
# echo "Adding code samples to openapi.json spec."
# ./node_modules/.bin/snippet-enricher-cli --targets="node_request,python_python3,go_native,shell_curl" --input=openapi.json > openapi-with-examples.json
# echo "Merging in JSON patches to correct and augment the OpenAPI spec."
# jq -s '.[0] * .[1]' openapi-with-examples.json openapi-patch.json > openapi-patched.json
echo "Run python script to generate examples"
python3 generate_examples.py
echo "Patch openapi < spec with examples we just created"
patch openapi.json circleci-examples.patch
echo Bundle api docs and remove unused components
npx redocly bundle openapi-patched.json --remove-unused-components --output openapi-final.json
npx redocly bundle openapi.json --remove-unused-components --output openapi-final.json
echo "Lint API docs"
npx redocly lint openapi-final.json
echo "Build docs with redocly cli."
Expand Down
Loading