Skip to content

Commit

Permalink
generate openapi spec api-doc
Browse files Browse the repository at this point in the history
FLPATH-1774
https://issues.redhat.com/browse/FLPATH-1774

Signed-off-by: Yaron Dayagi <[email protected]>
  • Loading branch information
ydayagi committed Dec 2, 2024
1 parent 0703b6a commit 7435548
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
name: orchestrator-backend
description: The Orchestrator backend plugin API
tags:
- orchestrator
spec:
type: openapi
lifecycle: experimental
owner: development
definition: |
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ components:
workflowId:
type: string
description: Workflow unique identifier
minLength: 1
minLength: 2
name:
type: string
description: Workflow name
Expand Down
6 changes: 6 additions & 0 deletions workspaces/orchestrator/scripts/postinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
mydir=`pwd`
cd ../../ && yarn install
cd $mydir
cd plugins/orchestrator-common
yarn openapi:check

0 comments on commit 7435548

Please sign in to comment.