docs: sync API docs from website #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OpenAPI generated types | |
| # Issue #37 phase 2: the checked-in generated artifacts must be reproducible | |
| # from docs/openapi/qveris-public-api.openapi.json. Regenerate with the pinned | |
| # generators and fail if the working tree differs (contract / generator drift). | |
| on: | |
| pull_request: | |
| paths: | |
| - "docs/openapi/**" | |
| - "packages/mcp/src/generated/**" | |
| - "packages/python-sdk/qveris/generated/**" | |
| - "packages/mcp/package.json" | |
| - "packages/python-sdk/pyproject.toml" | |
| - ".github/workflows/openapi-types.yml" | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "docs/openapi/**" | |
| - "packages/mcp/src/generated/**" | |
| - "packages/python-sdk/qveris/generated/**" | |
| - "packages/mcp/package.json" | |
| - "packages/python-sdk/pyproject.toml" | |
| - ".github/workflows/openapi-types.yml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| regen-and-diff: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Regenerate MCP TypeScript types | |
| run: npx --yes openapi-typescript@7.4.4 docs/openapi/qveris-public-api.openapi.json -o packages/mcp/src/generated/openapi.d.ts | |
| - name: Regenerate Python SDK models | |
| run: | | |
| python -m pip install --quiet "datamodel-code-generator==0.26.3" | |
| python -m datamodel_code_generator \ | |
| --input docs/openapi/qveris-public-api.openapi.json \ | |
| --input-file-type openapi \ | |
| --output packages/python-sdk/qveris/generated/openapi_models.py \ | |
| --output-model-type pydantic_v2.BaseModel \ | |
| --target-python-version 3.8 \ | |
| --use-schema-description \ | |
| --disable-timestamp | |
| - name: Fail on drift | |
| run: | | |
| if ! git diff --exit-code -- \ | |
| packages/mcp/src/generated/openapi.d.ts \ | |
| packages/python-sdk/qveris/generated/openapi_models.py; then | |
| echo "::error::Generated OpenAPI artifacts are out of date. Run 'npm --prefix packages/mcp run gen:openapi' and regenerate the Python models, then commit." | |
| exit 1 | |
| fi |