diff --git a/.github/workflows/openapi-pages.yml b/.github/workflows/openapi-pages.yml new file mode 100644 index 00000000..b39fd5ec --- /dev/null +++ b/.github/workflows/openapi-pages.yml @@ -0,0 +1,40 @@ +name: Update OpenAPI docs on GitHub Pages + +on: + push: + paths: + - 'openapi/**' + branches: + - master + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + docsgen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Generate static HTML page with docs from OpenAPI definition + run: | + docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralgw/master/openapi/owgw.yaml -l html2 --skip-validate-spec -o /local/ + + - name: Update OpenAPI docs + run: | + mkdir tmp-docs + mv index.html tmp-docs/index.html + mkdir -p ~/.ssh + ssh-keyscan -H github.com >> ~/.ssh/known_hosts + echo https://tip-automation:${{ secrets.GIT_PUSH_PAT }}@github.com > ~/.git-credentials + git config --global credential.helper store + git config --global user.email "tip-automation@telecominfraproject.com" + git config --global user.name "TIP Automation User" + git pull + git checkout gh-pages || git checkout -b gh-pages + mv tmp-docs docs + git add docs + git commit -m'Update OpenAPI docs for GitHub pages' + git push diff --git a/OPENAPI.md b/OPENAPI.md index 7ed55fbb..8b223f04 100644 --- a/OPENAPI.md +++ b/OPENAPI.md @@ -5,6 +5,11 @@ This document will describe how the API is built and how to use it. This uses OpenAPI definition 3.0 and can be found [here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/openapi/ucentral/owgw.yaml). All endpoints begin with `/api/v1`. +## OpenAPI docs +You may get static page with OpenAPI docs generated from the definition on [GitHub Page](https://telecominfraproject.github.io/wlan-cloud-ucentralgw). + +Also you may use [Swagger UI](https://petstore.swagger.io/#/) with OpenAPI definition file raw link (i.e. [latest version file](https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralgw/master/openapi/owgw.yaml)) to get interactive docs page. + ## The flow In order to use any of the API calls, you must obtain a token (I know - shocking). You do so by calling the end-point `/oauth2`. Once you obtain that `access-token`, you will need to pass it in the headers under `Authorization: Bearer `.