forked from eclipse-edc/Connector
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(doc): update the verification and generation of OpenAPI spec fil…
…es (eclipse-edc#2209) * feat: apply apiGroup configs * delete embedded swagger UI * bring back old and outdated Swagger UI * updated api specs * create-update logic for API doc
- Loading branch information
1 parent
8421cc0
commit eb5605a
Showing
33 changed files
with
189 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Verify and Publish OpenAPI Specs | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '**.md' | ||
- 'docs/**' | ||
- 'CODEOWNERS' | ||
- 'LICENSE' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Verify-OpenAPI-Definitions: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
apiGroup: [ 'management-api', 'control-api' ] | ||
env: | ||
rootDir: resources/openapi/yaml/${{ matrix.apiGroup }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-build | ||
|
||
- name: Save previous OpenAPI definition | ||
run: | | ||
mkdir -p git-sorted/${{ matrix.apiGroup }} | ||
files=($(ls $rootDir)) | ||
for file in ${files[@]}; do | ||
yq -P 'sort_keys(..)' $rootDir/$file > git-sorted/${{ matrix.apiGroup }}/$file | ||
done | ||
- name: Generate OpenAPI definitions from code | ||
run: | | ||
export | ||
./gradlew resolve | ||
# Can be used (and yq tasks removed) when https://github.com/kpramesh2212/openapi-merger-plugin/pull/11/files is merged | ||
#- name: Check OpenAPI definitions match code | ||
# run: git diff --exit-code | ||
|
||
- name: Check OpenAPI definitions match code | ||
run: | | ||
mkdir -p git-regen/${{ matrix.apiGroup }} | ||
files=($(ls resources/openapi/yaml/${{ matrix.apiGroup}})) | ||
for file in ${files[@]}; do | ||
yq -P 'sort_keys(..)' $rootDir/$file > git-regen/${{ matrix.apiGroup }}/$file | ||
done | ||
diff -r git-sorted git-regen | ||
Publish-To-SwaggerHub: | ||
# do NOT run on forks. The Org ("edc") is unique all across SwaggerHub | ||
if: github.repository == 'eclipse-edc/Connector' && github.event_name != 'pull_request' | ||
runs-on: ubuntu-latest | ||
needs: [ Verify-OpenAPI-Definitions ] | ||
strategy: | ||
matrix: | ||
apiGroup: [ 'management-api', 'control-api' ] | ||
env: | ||
rootDir: resources/openapi/yaml/${{ matrix.apiGroup }} | ||
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_TOKEN }} | ||
SWAGGERHUB_USER: ${{ secrets.SWAGGERHUB_USER }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/setup-build | ||
- uses: actions/setup-node@v3 | ||
|
||
# merge together all api groups | ||
- name: Generate API Specs | ||
run: | | ||
./gradlew -PapiTitle="${{ matrix.apiGroup }}" -PapiDescription="REST API documentation for the ${{ matrix.apiGroup }}" :mergeApiSpec --input=${{ env.rootDir }} --output=${{ matrix.apiGroup }}.yaml | ||
# install swaggerhub CLI | ||
- name: Install SwaggerHub CLI | ||
run: npm i -g swaggerhub-cli | ||
|
||
# create API, will fail if exists | ||
- name: Create API | ||
continue-on-error: true | ||
run: | | ||
swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/${{ matrix.apiGroup}} -f ${{ matrix.apiGroup }}.yaml --visibility=public --published=unpublish | ||
# Post the API to SwaggerHub as "unpublished", because published APIs cannot be overwritten | ||
- name: Publish API Specs to SwaggerHub | ||
run: | | ||
swaggerhub api:update ${{ env.SWAGGERHUB_USER }}/${{ matrix.apiGroup}} -f ${{ matrix.apiGroup }}.yaml --visibility=public --published=unpublish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-2.53 KB
...ommon/iam/decentralized-identity/identity-did-test/bin/testFixtures/edc-test-keystore.jks
Binary file not shown.
1 change: 0 additions & 1 deletion
1
.../common/iam/decentralized-identity/identity-did-test/bin/testFixtures/readme-keystore.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.