Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 add gh actions to check OAS #202

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/generate-postman-collection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: generate-postman-collection

on:
push:
paths:
- "src/openklant/components/*/openapi.yaml"
- ".github/workflows/generate-postman-collection.yml"
branches:
- '**'
workflow_dispatch:

jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
component: ['contactgegevens', 'klantinteracties']

name: Run with component ${{ matrix.component }}

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm install -g openapi-to-postmanv2
- name: Create tests folder
run: mkdir -p ./tests/postman
- name: Generate Postman collection
run: openapi2postmanv2 -s ./src/openklant/components/${{ matrix.component }}/openapi.yaml -o ./tests/postman/collection.json --pretty
42 changes: 42 additions & 0 deletions .github/workflows/generate-sdks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: generate-sdks

on:
push:
paths:
- "src/openklant/components/*/openapi.yaml"
- ".github/workflows/generate-sdks.yml"
branches:
- '**'
workflow_dispatch:

jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
component: ['contactgegevens', 'klantinteracties']

name: Run with component ${{ matrix.component }}

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: npm install -g @openapitools/openapi-generator-cli
- name: Determining oas path
id: vars
run: echo ::set-output name=oas::./src/openklant/components/${{ matrix.component }}/openapi.yaml
- name: Validate schema
run: openapi-generator-cli validate -i ${{ steps.vars.outputs.oas }}
- name: Generate Java client
run: openapi-generator-cli generate -i ${{ steps.vars.outputs.oas }} --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \
-o ./sdks/java -g java --additional-properties=dateLibrary=java8,java8=true,optionalProjectFile=false,optionalAssemblyInfo=false
- name: Generate .NET client
run: openapi-generator-cli generate -i ${{ steps.vars.outputs.oas }} --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \
-o ./sdks/net -g csharp --additional-properties=optionalProjectFile=false,optionalAssemblyInfo=false
- name: Generate Python client
run: openapi-generator-cli generate -i ${{ steps.vars.outputs.oas }} --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \
-o ./sdks/python -g python --additional-properties=optionalProjectFile=false,optionalAssemblyInfo=false+
30 changes: 30 additions & 0 deletions .github/workflows/lint-oas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: lint-oas

on:
push:
paths:
- "src/openklant/components/*/openapi.yaml"
- .github/workflows/lint-oas.yml
branches:
- '**'
workflow_dispatch:

jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
component: ['contactgegevens', 'klantinteracties']

name: Run with component ${{ matrix.component }}

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install spectral
run: npm install -g @stoplight/spectral@5
- name: Run OAS linter
run: spectral lint ./src/openklant/components/${{ matrix.component }}/openapi.yaml
4 changes: 4 additions & 0 deletions src/openklant/components/contactgegevens/api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
"TITLE": "contactgegevens",
"DESCRIPTION": description,
"VERSION": settings.CONTACTGEGEVENS_API_VERSION,
"TAGS": [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schemas probably have to be regenerated to add these tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Updated OAS

{"name": "organisaties"},
{"name": "personen"},
],
}
16 changes: 16 additions & 0 deletions src/openklant/components/klantinteracties/api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,20 @@
"TITLE": "klantinteracties",
"DESCRIPTION": description,
"VERSION": settings.KLANTINTERACTIES_API_VERSION,
"TAGS": [
{"name": "actoren"},
{"name": "actor klantcontacten"},
{"name": "betrokkenen"},
{"name": "bijlagen"},
{"name": "categorie relaties"},
{"name": "categorieën"},
{"name": "digitale adressen"},
{"name": "interne taken"},
{"name": "klanten contacten"},
{"name": "onderwerpobjecten"},
{"name": "partij-identificatoren"},
{"name": "partijen"},
{"name": "rekeningnummers"},
{"name": "vertegenwoordigingen"},
],
}
Loading