Skip to content

Commit

Permalink
Merge pull request #101 from ydayagi/flpath1774
Browse files Browse the repository at this point in the history
generate openapi spec api-doc
  • Loading branch information
batzionb authored Dec 2, 2024
2 parents 319a490 + b6cf167 commit 948e2ad
Show file tree
Hide file tree
Showing 6 changed files with 770 additions and 2 deletions.
5 changes: 5 additions & 0 deletions workspaces/orchestrator/.changeset/polite-chicken-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-orchestrator-common': patch
---

generate openapi spec api-doc
2 changes: 1 addition & 1 deletion workspaces/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"new": "backstage-cli new --scope @red-hat-developer-hub",
"postinstall": "cd ../../ && yarn install"
"postinstall": "./scripts/postinstall"
},
"workspaces": {
"packages": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ API_FOLDER="${GENERATED_FOLDER}/api"
DEFINITION_FILE="${API_FOLDER}/definition.ts"
METADATA_FILE="${GENERATED_FOLDER}/.METADATA.sha1"
CLIENT_FOLDER="${GENERATED_FOLDER}/client"
APIDOC_TEMPLATE_FILE="./src/openapi/api-doc-template.yaml"
APIDOC_GENERATED_FILE=${GENERATED_FOLDER}/docs/api-doc/orchestrator-api.yaml

openapi_generate() {
# TypeScript Client generation
rm -rf ${CLIENT_FOLDER}
openapi-generator-cli generate -g typescript-axios -i ${OPENAPI_SPEC_FILE} -o ${CLIENT_FOLDER}

# Docs generation
rm -rf ./src/generated/docs/markdown ./src/generated/docs/html
rm -rf ./src/generated/docs/markdown ./src/generated/docs/html ./src/generated/docs/api-doc
openapi-generator-cli generate -g markdown -i ${OPENAPI_SPEC_FILE} -o ./src/generated/docs/markdown/
openapi-generator-cli generate -g html2 -i ${OPENAPI_SPEC_FILE} -o ./src/generated/docs/html
mkdir ./src/generated/docs/api-doc
cp $APIDOC_TEMPLATE_FILE $APIDOC_GENERATED_FILE
cat $OPENAPI_SPEC_FILE | sed 's/^/ /g' >> $APIDOC_GENERATED_FILE


yaml2json -f ${OPENAPI_SPEC_FILE}

Expand Down
Loading

0 comments on commit 948e2ad

Please sign in to comment.