Skip to content

Commit

Permalink
Merge pull request #202 from maykinmedia/feature/gh-oas-check
Browse files Browse the repository at this point in the history
👷 add gh actions to check OAS
  • Loading branch information
annashamray authored Jul 25, 2024
2 parents bba6e02 + 3190e69 commit 81f16aa
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 0 deletions.
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": [
{"name": "organisaties"},
{"name": "personen"},
],
}
3 changes: 3 additions & 0 deletions src/openklant/components/contactgegevens/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,6 @@ components:
in: header
name: Authorization
description: Token-based authentication with required prefix "Token"
tags:
- 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"},
],
}
15 changes: 15 additions & 0 deletions src/openklant/components/klantinteracties/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4962,3 +4962,18 @@ components:
in: header
name: Authorization
description: Token-based authentication with required prefix "Token"
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

0 comments on commit 81f16aa

Please sign in to comment.