From 2188ef10b049c4a7a1302827f84df02bf6433ed3 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Sat, 21 Sep 2024 16:38:52 +0100 Subject: [PATCH 1/2] Add OpenAPI linter to CI --- .github/workflows/validate-openapi.yml | 14 ++++++++++++++ .redocly.lint-ignore.yaml | 6 ++++++ redocly.yaml | 6 ++++++ 3 files changed, 26 insertions(+) create mode 100644 .github/workflows/validate-openapi.yml create mode 100644 .redocly.lint-ignore.yaml create mode 100644 redocly.yaml diff --git a/.github/workflows/validate-openapi.yml b/.github/workflows/validate-openapi.yml new file mode 100644 index 0000000..5675ab9 --- /dev/null +++ b/.github/workflows/validate-openapi.yml @@ -0,0 +1,14 @@ +on: [push] + +jobs: + validate_openapi: + runs-on: ubuntu-latest + name: Validate OpenAPI definitions + steps: + - uses: actions/checkout@v4 + - name: Install OpenAPI validator + run: npm install -g @redocly/cli + - name: Validate definitions + run: redocly lint Swagger/*.yaml + env: + NODE_NO_WARNINGS: 1 diff --git a/.redocly.lint-ignore.yaml b/.redocly.lint-ignore.yaml new file mode 100644 index 0000000..6f29508 --- /dev/null +++ b/.redocly.lint-ignore.yaml @@ -0,0 +1,6 @@ +# This file instructs Redocly's linter to ignore the rules contained for specific parts of your API. +# See https://redoc.ly/docs/cli/ for more information. +Swagger/AlpacaManagementAPI_v1.yaml: + # /setup endpoint must always be present + operation-4xx-response: + - '#/paths/~1setup/get/responses' diff --git a/redocly.yaml b/redocly.yaml new file mode 100644 index 0000000..eeca968 --- /dev/null +++ b/redocly.yaml @@ -0,0 +1,6 @@ +extends: + - recommended +rules: + security-defined: off + operation-operationId: off + info-license: off From 8e9bcf496fc63d4b2a9ea527fc5a7575aed9bde0 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Sat, 21 Sep 2024 16:39:15 +0100 Subject: [PATCH 2/2] Fix issues with misplaced `deprecated` field --- Swagger/AlpacaDeviceAPI_v1.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Swagger/AlpacaDeviceAPI_v1.yaml b/Swagger/AlpacaDeviceAPI_v1.yaml index b5d446c..63ee6fa 100644 --- a/Swagger/AlpacaDeviceAPI_v1.yaml +++ b/Swagger/AlpacaDeviceAPI_v1.yaml @@ -146,8 +146,8 @@ paths: - Action - Parameters '/{device_type}/{device_number}/commandblind': - deprecated: true put: + deprecated: true summary: Transmits an arbitrary string to the device description: >- Transmits an arbitrary string to the device and does not wait for a @@ -192,8 +192,8 @@ paths: requestBody: $ref: '#/components/requestBodies/put_devicetype_Devicenumber_commandblind' '/{device_type}/{device_number}/commandstring': - deprecated: true put: + deprecated: true summary: >- Transmits an arbitrary string to the device and returns a string value from the device.