Skip to content

online-bridge-hackathon/gcp-cf-docsgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gcp-cf-docsgen

JavaScript Style Guide Inline docs NPM Version License contributions welcome

Overview

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.


Current features

  • 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

CD/CI

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.


Installation and Setup

- REQUIREMENTS

- ENVIRONMENT VARIABLES

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.

- PACKAGES

npm install

Usage

Upload or Delete a spec to Global Bridge App's Api Bucket: https://storage.cloud.google.com/gba-apis


Tests

The accessible entry points(onUpload and onDelete) are tested against well formed and badly formed spec inputs.

npm run test
npm run coverage

Docs

Generate docs for the #Code-Documentation section of this readme

npm run docs

License

MIT


Code-Documentation

Table of Contents

onUpload

GCP Cloud Function onUpload. Generates both the API documentation for a given spec (OpenApi-v3 or AsyncApi-v2) and the main page.

Parameters

onDelete

GCP Cloud Function onDelete. Updates the main page.

Parameters

About

GCP Cloud Function to generate API Docs

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors