Skip to content

Commit

Permalink
Merge pull request #172 from open-zaak/feature/gh-check-oas
Browse files Browse the repository at this point in the history
👷 add OAS checks as gh actions
  • Loading branch information
annashamray authored Jul 11, 2024
2 parents ad8a7ff + 7fef198 commit 7533658
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 13 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/generate-postman-collection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: generate-postman-collection

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

jobs:
run:
runs-on: ubuntu-latest
name: Generate Postman collection

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/openapi.yaml -o ./tests/postman/collection.json --pretty
38 changes: 38 additions & 0 deletions .github/workflows/generate-sdks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: generate-sdks

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

jobs:
run:
runs-on: ubuntu-latest
name: Generate SDK

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: Determing oas path
id: vars
run: echo ::set-output name=oas::./src/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+
26 changes: 26 additions & 0 deletions .github/workflows/lint-oas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: lint-oas

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

jobs:
run:
runs-on: ubuntu-latest
name: Lint OAS

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/openapi.yaml
1 change: 1 addition & 0 deletions src/nrc/conf/includes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
}
}
},
"TAGS": [{"name": "abonnement"}, {"name": "kanaal"}, {"name": "notificaties"}],
}

GEMMA_URL_INFORMATIEMODEL_VERSIE = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions src/nrc/utils/oas_extensions/hyperlink_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def map_serializer_field(self, auto_schema, direction):
"URL-referentie naar dit object. Dit is de unieke "
"identificatie en locatie van dit object."
),
"min_length": 1,
"max_length": 1000,
"minLength": 1,
"maxLength": 1000,
}
21 changes: 10 additions & 11 deletions src/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1477,11 +1477,6 @@ paths:
type: string
description: 'Geeft een specifieke API-versie aan in de context van
een specifieke aanroep. Voorbeeld: 1.2.1.'
Location:
schema:
type: string
format: uri
description: URL waar de resource leeft.
content:
application/json:
schema:
Expand Down Expand Up @@ -1606,8 +1601,8 @@ components:
readOnly: true
description: URL-referentie naar dit object. Dit is de unieke identificatie
en locatie van dit object.
min_length: 1
max_length: 1000
minLength: 1
maxLength: 1000
callbackUrl:
type: string
format: uri
Expand Down Expand Up @@ -1706,8 +1701,8 @@ components:
readOnly: true
description: URL-referentie naar dit object. Dit is de unieke identificatie
en locatie van dit object.
min_length: 1
max_length: 1000
minLength: 1
maxLength: 1000
naam:
type: string
description: Naam van het KANAAL (ook wel "Exchange" genoemd) dat de bron
Expand Down Expand Up @@ -1783,8 +1778,8 @@ components:
readOnly: true
description: URL-referentie naar dit object. Dit is de unieke identificatie
en locatie van dit object.
min_length: 1
max_length: 1000
minLength: 1
maxLength: 1000
callbackUrl:
type: string
format: uri
Expand Down Expand Up @@ -1846,3 +1841,7 @@ components:
bearerFormat: JWT
servers:
- url: /api/v1
tags:
- name: abonnement
- name: kanaal
- name: notificaties

0 comments on commit 7533658

Please sign in to comment.