Skip to content

Commit a48bef6

Browse files
trying swagger for UI docs.
1 parent c9f3336 commit a48bef6

File tree

10 files changed

+70
-6
lines changed

10 files changed

+70
-6
lines changed

.github/actions/build-sdk/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ runs:
3333
shell: bash
3434
run: mkdir python
3535

36+
- name: make swagger folder
37+
working-directory: ./sdk
38+
shell: bash
39+
run: mkdir swagger
40+
3641
- name: Build sdks
3742
working-directory: ./sdk
3843
shell: bash
@@ -44,6 +49,12 @@ runs:
4449
path: "sdk/html"
4550
name: sdk-html-${{ inputs.version }}
4651

52+
- name: Upload swagger artifact
53+
uses: actions/upload-artifact@v4
54+
with:
55+
path: "sdk/swagger"
56+
name: sdk-swagger-${{ inputs.version }}
57+
4758
- name: Upload ts artifact
4859
uses: actions/upload-artifact@v4
4960
with:
@@ -68,3 +79,9 @@ runs:
6879
with:
6980
path: "sdk/html/"
7081
name: sdk-html-docs-${{ inputs.version }}
82+
83+
- name: Upload swagger pages artifact
84+
uses: actions/upload-pages-artifact@v3
85+
with:
86+
path: "sdk/swagger/"
87+
name: sdk-swagger-docs-${{ inputs.version }}

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "1. CI/CD pull request"
1+
name: "1. CI - Pull Request"
22

33
# The total recommended execution time for the "CI/CD Pull Request" workflow is around 20 minutes.
44

.github/workflows/cicd-3-deploy.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "2. Deploy docs to GitHub Pages"
1+
name: "2. CD - Deploy"
22

33
on:
44
workflow_dispatch:
@@ -102,18 +102,18 @@ jobs:
102102
env:
103103
GH_TOKEN: ${{ github.token }}
104104
run: |
105-
gh release download ${{steps.get-asset-version.outputs.release_version}} -p sdk-html-docs-*.tar --output artifact.tar
105+
gh release download ${{steps.get-asset-version.outputs.release_version}} -p sdk-swagger-docs-*.tar --output artifact.tar
106106
107107
- uses: actions/upload-artifact@v4
108108
with:
109-
name: sdk-html-docs-${{steps.get-asset-version.outputs.release_version}}
109+
name: sdk-swagger-docs-${{steps.get-asset-version.outputs.release_version}}
110110
path: artifact.tar
111111

112112
- name: Deploy to GitHub Pages
113113
id: deployment
114114
uses: actions/deploy-pages@v4
115115
with:
116-
artifact_name: sdk-html-docs-${{steps.get-asset-version.outputs.release_version}}
116+
artifact_name: sdk-swagger-docs-${{steps.get-asset-version.outputs.release_version}}
117117

118118

119119
### BELOW WAS THE DEFAULT USING THE JEKYLL BUILD

.github/workflows/stage-5-publish.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ jobs:
8282
asset_name: sdk-html-docs-${{ inputs.version }}.tar
8383
asset_content_type: "application/gzip"
8484

85+
- name: "Upload sdk swagger docs release asset"
86+
uses: actions/upload-release-asset@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
upload_url: "${{ steps.create_release.outputs.upload_url }}"
91+
asset_path: ./artifacts/sdk-swagger-docs-${{ inputs.version }}/artifact.tar
92+
asset_name: sdk-swagger-docs-${{ inputs.version }}.tar
93+
asset_content_type: "application/gzip"
94+
8595
#- name: "tar gz jekyll docs release asset"
8696
# # Git hub pages needs a single tar called artifact inside the zip.
8797
# working-directory: ./artifacts/jekyll-docs-${{ inputs.version }}

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ clean:: # Clean-up project resources (main) @Operations
2727
serve:
2828
npm run serve
2929

30+
serve-swagger:
31+
npm run serve-swagger-docs
3032

3133
config:: _install-dependencies version # Configure development environment (main) @Configuration
3234
npm install

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"lint:fix": "npm run lint:fix --workspaces",
5656
"serve": "npm run serve-html-docs",
5757
"serve-html-docs": "npx serve sdk/html -p 3050",
58+
"serve-swagger-docs": "npx serve sdk/swagger -p 3051",
5859
"start": "npm run start --workspace frontend",
5960
"test:unit": "npm run test:unit --workspaces",
6061
"typecheck": "npm run typecheck --workspaces"

sdk/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SHELL = /bin/bash
44

55
build: version # Build the project artefact @Pipeline
66
cd .. && npm run build && cd sdk
7+
./swagger-static.sh
78

89
clean: # Clean-up project resources (main) @Operations
910
rm -rf */

sdk/_config.version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 0.0.1-20250703.074729+c9e6134
1+
version: 0.0.1-20250703.100841+c9f3336

sdk/swagger-initializer.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
window.onload = function() {
2+
//<editor-fold desc="Changeable Configuration Block">
3+
4+
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
5+
window.ui = SwaggerUIBundle({
6+
url: "swagger.json",
7+
dom_id: '#swagger-ui',
8+
deepLinking: true,
9+
presets: [
10+
SwaggerUIBundle.presets.apis,
11+
SwaggerUIStandalonePreset
12+
],
13+
plugins: [
14+
SwaggerUIBundle.plugins.DownloadUrl
15+
],
16+
layout: "StandaloneLayout"
17+
});
18+
19+
//</editor-fold>
20+
};

sdk/swagger-static.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/sh
2+
3+
VERSION=5.26.0
4+
wget https://github.com/swagger-api/swagger-ui/archive/refs/tags/v$VERSION.zip -O swagger.zip
5+
mkdir -p swagger
6+
rm -r swagger/*
7+
8+
unzip swagger.zip "swagger-ui-$VERSION/dist/*" -d swagger
9+
mv swagger/swagger-ui-$VERSION/dist/* swagger
10+
rm -r swagger/swagger-ui-$VERSION
11+
cp swagger-initializer.js swagger/swagger-initializer.js
12+
cp ../specification/api/notify-supplier.yml swagger/swagger.json
13+
rm swagger.zip

0 commit comments

Comments
 (0)