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 all 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"},
],
}
9 changes: 9 additions & 0 deletions src/openklant/components/contactgegevens/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: 3.0.3

Check warning on line 1 in src/openklant/components/contactgegevens/openapi.yaml

View workflow job for this annotation

GitHub Actions / Run with component contactgegevens

oas3-api-servers
info:
title: contactgegevens
version: 1.0.0
Expand Down Expand Up @@ -404,6 +404,9 @@
minLength: 4
PaginatedOrganisatieList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -424,6 +427,9 @@
$ref: '#/components/schemas/Organisatie'
PaginatedPersoonList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand Down Expand Up @@ -668,3 +674,6 @@
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"},
],
}
66 changes: 63 additions & 3 deletions src/openklant/components/klantinteracties/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: 3.0.3

Check warning on line 1 in src/openklant/components/klantinteracties/openapi.yaml

View workflow job for this annotation

GitHub Actions / Run with component klantinteracties

oas3-api-servers
info:
title: klantinteracties
version: 0.0.3
Expand Down Expand Up @@ -3330,13 +3330,11 @@
afgehandeldOp:
type: string
format: date-time
readOnly: true
nullable: true
description: 'Datum en tijdstip wanneer de interne taak was afgehandeld:
EXPERIMENTEEL.'
required:
- aanleidinggevendKlantcontact
- afgehandeldOp
- gevraagdeHandeling
- status
- toegewezenAanActor
Expand Down Expand Up @@ -3560,6 +3558,9 @@
maxLength: 200
PaginatedActorKlantcontactList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3580,6 +3581,9 @@
$ref: '#/components/schemas/ActorKlantcontact'
PaginatedActorList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3600,6 +3604,9 @@
$ref: '#/components/schemas/Actor'
PaginatedBetrokkeneList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3620,6 +3627,9 @@
$ref: '#/components/schemas/Betrokkene'
PaginatedBijlageList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3640,6 +3650,9 @@
$ref: '#/components/schemas/Bijlage'
PaginatedCategorieList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3660,6 +3673,9 @@
$ref: '#/components/schemas/Categorie'
PaginatedCategorieRelatieList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3680,6 +3696,9 @@
$ref: '#/components/schemas/CategorieRelatie'
PaginatedDigitaalAdresList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3700,6 +3719,9 @@
$ref: '#/components/schemas/DigitaalAdres'
PaginatedExpandKlantcontactList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3720,6 +3742,9 @@
$ref: '#/components/schemas/ExpandKlantcontact'
PaginatedExpandPartijList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3740,6 +3765,9 @@
$ref: '#/components/schemas/ExpandPartij'
PaginatedInterneTaakList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3758,8 +3786,11 @@
type: array
items:
$ref: '#/components/schemas/InterneTaak'
PaginatedKlantcontactList:

Check warning on line 3789 in src/openklant/components/klantinteracties/openapi.yaml

View workflow job for this annotation

GitHub Actions / Run with component klantinteracties

oas3-unused-components-schema Potentially unused components schema has been detected.
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3780,6 +3811,9 @@
$ref: '#/components/schemas/Klantcontact'
PaginatedOnderwerpobjectList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3800,6 +3834,9 @@
$ref: '#/components/schemas/Onderwerpobject'
PaginatedPartijIdentificatorList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3818,8 +3855,11 @@
type: array
items:
$ref: '#/components/schemas/PartijIdentificator'
PaginatedPartijList:

Check warning on line 3858 in src/openklant/components/klantinteracties/openapi.yaml

View workflow job for this annotation

GitHub Actions / Run with component klantinteracties

oas3-unused-components-schema Potentially unused components schema has been detected.
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3840,6 +3880,9 @@
$ref: '#/components/schemas/Partij'
PaginatedRekeningnummerList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand All @@ -3860,6 +3903,9 @@
$ref: '#/components/schemas/Rekeningnummer'
PaginatedVertegenwoordigdenList:
type: object
required:
- count
- results
properties:
count:
type: integer
Expand Down Expand Up @@ -4504,7 +4550,6 @@
afgehandeldOp:
type: string
format: date-time
readOnly: true
nullable: true
description: 'Datum en tijdstip wanneer de interne taak was afgehandeld:
EXPERIMENTEEL.'
Expand Down Expand Up @@ -4917,3 +4962,18 @@
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
Loading