GCP Cloud Function to generate and update documentation for the different projects of Global Bridge App.
Triggered when a new/updated spec is uploaded to Global Bridge App's gba-apis bucket. Output documentation is uploaded to the gba-docs bucket.
A main HomePage is also rendered based on the specs currently active @gba-docs using a simple mustache template. See /templates/readme.html.md.mustache
Currently supports OpenApi V3 for REST APIs and AsyncApi V2 for Event Driven/Asynchronous APIs specifications.
- Renders a Main HomePage using Widdershins based on the current uploaded specs @gba-apis
- Renders a slate/shin markdown page with code samples for each project using Widdershins and Shins
- Renders an HTML page with code samples for each project using Redoc and AsyncDoc
- Auto links to a Swagger/Asyncapi playground with live "try-out"
- Postman collections linkage
This project's master branch is hooked to gcp's Cloud Build.
Deploys onUpdate and onDelete entry points as cloud functions.
Coverage(nyc) thresholds are currently set to 100%.
See cloudbuild.yaml for specifics.
- NodeJS (v12+)
The following environment variables must be set either at the cloud environment or using .env or something simillar. They are not required for testing purposes.
-
API_BUCKET - gcp APIs bucket name
-
DOCS_BUCKET - gcp DOCS output bucket name
The following environment variables may be set either at the cloud environment or using .env or something simillar. They are not required for testing purposes.
If ommited, the Postman collection will not be updated.
- POSTMAN_APIKEY - Postman API Key for updating collections. See https://explore.postman.com/globalbridge-app
npm install
Upload or Delete a spec to Global Bridge App's Api Bucket: https://storage.cloud.google.com/gba-apis
The accessible entry points(onUpload and onDelete) are tested against well formed and badly formed spec inputs.
npm run test
npm run coverage
Generate docs for the #Code-Documentation section of this readme
npm run docs
GCP Cloud Function onUpload. Generates both the API documentation for a given spec (OpenApi-v3 or AsyncApi-v2) and the main page.
fileObject [File object]{@ https://googleapis.dev/nodejs/storage/latest/Bucket.html#file} from GCPcontextObjectcallbackFunction Callback signal to GCP
GCP Cloud Function onDelete. Updates the main page.
fileObject [File object]{@ https://googleapis.dev/nodejs/storage/latest/Bucket.html#file}contextObjectcallbackFunction Callback signal to GCP