diff --git a/.github/workflows/openapi-lint.yml b/.github/workflows/openapi-lint.yml new file mode 100644 index 0000000..2995996 --- /dev/null +++ b/.github/workflows/openapi-lint.yml @@ -0,0 +1,35 @@ +name: Lint OpenAPI Specs + +on: + push: + branches: [ main, master ] + paths: + - 'specs/**' + - '.github/workflows/openapi-lint.yml' + - '.spectral.yaml' + pull_request: + branches: [ main, master ] + paths: + - 'specs/**' + - '.github/workflows/openapi-lint.yml' + - '.spectral.yaml' + +jobs: + lint: + name: Lint OpenAPI files with Spectral + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Spectral + run: npm install -g @stoplight/spectral-cli + + - name: Lint OpenAPI Specs + run: spectral lint "specs/*.openapi.yml" --verbose + diff --git a/.spectral.yaml b/.spectral.yaml new file mode 100644 index 0000000..0a66cda --- /dev/null +++ b/.spectral.yaml @@ -0,0 +1,7 @@ +extends: spectral:oas + +rules: + # Disable validation of examples for non-JSON media types (like jsonl) + # because Spectral tries to parse them as JSON and fails on multi-line/concatenated JSON + oas3-valid-media-example: off +