From 4216120dd11dd0cc39bcd477f94d014dccff0ab2 Mon Sep 17 00:00:00 2001 From: Anna Shamray Date: Thu, 11 Jul 2024 15:09:20 +0200 Subject: [PATCH] :construction_worker: [https://github.com/open-zaak/open-zaak/issues/1708] add gh actions to check OAS --- .../workflows/generate-postman-collection.yml | 32 ++++++++++++++ .github/workflows/generate-sdks.yml | 42 +++++++++++++++++++ .github/workflows/lint-oas.yml | 30 +++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 .github/workflows/generate-postman-collection.yml create mode 100644 .github/workflows/generate-sdks.yml create mode 100644 .github/workflows/lint-oas.yml diff --git a/.github/workflows/generate-postman-collection.yml b/.github/workflows/generate-postman-collection.yml new file mode 100644 index 00000000..eae48a2b --- /dev/null +++ b/.github/workflows/generate-postman-collection.yml @@ -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 diff --git a/.github/workflows/generate-sdks.yml b/.github/workflows/generate-sdks.yml new file mode 100644 index 00000000..6006710f --- /dev/null +++ b/.github/workflows/generate-sdks.yml @@ -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+ diff --git a/.github/workflows/lint-oas.yml b/.github/workflows/lint-oas.yml new file mode 100644 index 00000000..ad3f13fd --- /dev/null +++ b/.github/workflows/lint-oas.yml @@ -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