From c52671a3ae17bc6f8312165cb7a5978c3b931974 Mon Sep 17 00:00:00 2001 From: Alex Smolen Date: Fri, 23 Oct 2026 09:52:03 -0700 Subject: [PATCH] Validate OpenAPI JSON on pull requests --- .github/workflows/validate-openapi.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/validate-openapi.yml diff --git a/.github/workflows/validate-openapi.yml b/.github/workflows/validate-openapi.yml new file mode 100644 index 0000000..4ca530c --- /dev/null +++ b/.github/workflows/validate-openapi.yml @@ -0,0 +1,25 @@ +name: Validate OpenAPI spec + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + validate-spec: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Validate JSON spec structure + run: | + python - <<'PY' + import json + from pathlib import Path + + spec = json.loads(Path('openapi/spec.json').read_text()) + assert str(spec.get('openapi', '')).startswith('3.'), 'Expected OpenAPI 3 specification' + assert isinstance(spec.get('paths'), dict) and spec['paths'], 'Specification has no paths' + PY