From 025991895b0e3f42b5dcdfd51359df393a4d41b8 Mon Sep 17 00:00:00 2001 From: Sarah Jones <77615158+SarahCoilAccount@users.noreply.github.com> Date: Fri, 4 Nov 2022 19:37:27 +0200 Subject: [PATCH] chore: add validation for the OpenAPI specs to GitHub Actions (#726) --- .github/workflows/lint_test_build.yml | 8 ++++++++ packages/auth/openapi/id-provider.yaml | 2 +- packages/auth/openapi/resource-server.yaml | 8 ++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint_test_build.yml b/.github/workflows/lint_test_build.yml index a3f45429b2..64969b2fb2 100644 --- a/.github/workflows/lint_test_build.yml +++ b/.github/workflows/lint_test_build.yml @@ -45,9 +45,17 @@ jobs: timeout-minutes: 5 steps: - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 - uses: ./.github/workflows/rafiki/env-setup - run: pnpm --filter openapi build - run: pnpm --filter auth test + - run: pnpm --filter auth run fetch-schemas + - name: AsyncAPI extension + run: | + echo "{\"extends\":[\"spectral:oas\",\"spectral:asyncapi\"]}" >> .spectral.json + - name: Validate Open API specs + run: | + npx @stoplight/spectral-cli lint ./packages/auth/openapi/id-provider.yaml ./packages/auth/openapi/resource-server.yaml openapi: runs-on: ubuntu-latest diff --git a/packages/auth/openapi/id-provider.yaml b/packages/auth/openapi/id-provider.yaml index 9ace050d1c..1d9529f4ac 100644 --- a/packages/auth/openapi/id-provider.yaml +++ b/packages/auth/openapi/id-provider.yaml @@ -99,7 +99,7 @@ paths: type: object properties: access: - $ref: ./schemas.yaml#/access + $ref: ./schemas.yaml#/components/schemas/access '404': description: Not Found operationId: get-grant diff --git a/packages/auth/openapi/resource-server.yaml b/packages/auth/openapi/resource-server.yaml index 60fb94de6b..2b088dd0e2 100644 --- a/packages/auth/openapi/resource-server.yaml +++ b/packages/auth/openapi/resource-server.yaml @@ -33,9 +33,9 @@ paths: grant: type: string access: - $ref: ./schemas.yaml#/access + $ref: ./schemas.yaml#/components/schemas/access key: - $ref: ./schemas.yaml#/key + $ref: ./schemas.yaml#/components/schemas/key client_id: type: string description: Opaque client identifier. @@ -86,11 +86,11 @@ paths: description: The proofing method used by the client instance to bind the token to the RS request. resource_server: oneOf: - - $ref: ./schemas.yaml#/key + - $ref: ./schemas.yaml#/components/schemas/key - type: string description: 'The identification used to authenticate the resource server making this call, either by value or by reference.' access: - $ref: ./schemas.yaml#/access + $ref: ./schemas.yaml#/components/schemas/access required: - access_token - resource_server