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