Skip to content

Commit

Permalink
chore: add scripts and config for openapi gen
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Jan 2, 2022
1 parent 6dfe37a commit 66aae5a
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
21 changes: 21 additions & 0 deletions generate-api-doc-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

declare -r TMP_FOLDER='../discue-io-api-docs-next/./tmp'
declare -r INTERMEDIATE_FILE="${TMP_FOLDER}/api-endpoints-intermediate.md"
declare -r ENVIRONMENT_FILE="../discue-io-api-docs-next/generate-api-doc.config.json"
declare -r TEMPLATE_FOLDER="../discue-io-api-docs-next/templates"

declare -r API_INPUT_FILE="../discue-io-api-docs-next/api.yaml"

declare -r FINAL_TITLE="Endpoints"
declare -r FINAL_FILE_PATH="../discue-io-api-docs-next/docs/endpoints/README.md"

mkdir -p "${TMP_FOLDER}"

cd ../widdershins && node widdershins -e "${ENVIRONMENT_FILE}" -o "${INTERMEDIATE_FILE}" -u "${TEMPLATE_FOLDER}" "${API_INPUT_FILE}" \
&& sed -i "s/title: .*/title: ${FINAL_TITLE}/" "${INTERMEDIATE_FILE}" \
&& cp ./"${INTERMEDIATE_FILE}" ${FINAL_FILE_PATH}

rm -rf "${TMP_FOLDER}"
35 changes: 35 additions & 0 deletions generate-api-doc.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"headings": 3,
"language_tabs": [
{
"javascript": "JavaScript"
},
{
"python": "Python"
},
{
"go": "Go"
}
],
"verbose": false,
"tagGroups": [
{
"title": "Messages",
"tags": [
"queue messages"
]
},
{
"title": "Listeners",
"tags": [
"queue listeners"
]
},
{
"title": "Queues",
"tags": [
"queues"
]
}
]
}
21 changes: 21 additions & 0 deletions generate-api-doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

declare -r TMP_FOLDER='../discue-io-docs-next/./tmp'
declare -r INTERMEDIATE_FILE="${TMP_FOLDER}/api-endpoints-intermediate.md"
declare -r ENVIRONMENT_FILE="../discue-io-docs-next/generate-api-doc.config.json"
declare -r TEMPLATE_FOLDER="../discue-io-docs-next/templates"

declare -r API_INPUT_FILE="../discue-io-docs-next/api.yaml"

declare -r FINAL_TITLE="Endpoints"
declare -r FINAL_FILE_PATH="../discue-io-api-docs-next/docs/endpoints/README.md"

mkdir -p "${TMP_FOLDER}"

npx widdershins -e "${ENVIRONMENT_FILE}" -o "${INTERMEDIATE_FILE}" -u ."${TEMPLATE_FOLDER}" "${API_INPUT_FILE}" \
&& sed -i "s/title: .*/title: ${FINAL_TITLE}/" "${INTERMEDIATE_FILE}" \
&& cp ./"${INTERMEDIATE_FILE}" ${FINAL_FILE_PATH}

rm -rf "${TMP_FOLDER}"

0 comments on commit 66aae5a

Please sign in to comment.