DataHub OpenAPI Specification
Steps to update the documentation (needs to be done for skylight-api and datahub-api repos)
- The spec/swagger.yaml will need to be updated with the latest Gather swagger.yaml.
To do this, go to the Gather master branch in adh-gather repo, and replace the ##### GATHER PATHS #####
and ##### GATHER DEFINITIONS ##### portion with the latest one.
- After this, go to the Accedian/stitchIt repo, and from the master branch get the latest openapi.yaml.
Run the command:
brew install npm
npx @redocly/cli build-docs openapi.yaml
This will generate a static html file. Edit the HTML file, if needed, to have the latest Release Date.
For example, replace all instances of 23.08 with 23.11 - this is only necessary if the openapi.yaml
has not had any updates since the last release.
Rename this file to session-stitchIt.html and replace the existing HTML file in
the skylight-api/web/ and datahub-api/web/ folder.
- Go to Accedian/sensor-orchestrate repo https://github.com/Accedian/sensor-orchestrate/blob/master/_resources/static/docs.html
(copy and paste all into /web/agent-orchestration.html).
- For Capture-Orchestration, please go to https://console.cloud.google.com/storage/browser/pykouze-openapi
and download the HTML for the specific release date. Rename this file to capture-orchestration.html and place it in the web folder.
- Once this is done, create the PR.
Steps to finish
- Enable Travis for your repository (note: you already have
.travis.yml
file)
- Create GitHub access token; check
public_repo
on Select scopes
section.
- Use the token value as a value for Travis environment variable with the name
GH_TOKEN
- Make a test commit to trigger CI:
git commit --allow-empty -m "Test Travis CI" && git push
- Wait until Travis build is finished. You can check progress by clicking on the
Build Status
badge at the top
- If you did everything correct, https://accedian.github.io/datahub-api/ will lead to your new docs
- [Optional] You can setup custom domain (just create
web/CNAME
file)
- Start writing/editing your OpenAPI spec: check out usage section below
- [Optional] If you document public API consider adding it into APIs.guru directory using this form.
- Delete this section :smile:
Links
Warning: All above links are updated only after Travis CI finishes deployment
Working on specification
Install
- Install Node JS
- Clone repo and
cd
Usage
- Run
npm start
- Checkout console output to see where local server is started. You can use all links (except
preview
) by replacing https://accedian.github.io/datahub-api/ with url from the message: Server started <url>
- Make changes using your favorite editor or
swagger-editor
(look for URL in console output)
- All changes are immediately propagated to your local server, moreover all documentation pages will be automagically refreshed in a browser after each change
TIP: you can open
swagger-editor
, documentation and swagger-ui
in parallel
- Once you finish with the changes you can run tests using:
npm test
- Share you changes with the rest of the world by pushing to GitHub :smile