Skip to content

Param defaults and Form/Body models as FastAPI declares them; descriptions of derived bodies - #86

Open
velis74 wants to merge 3 commits into
mainfrom
openapi-pk-default-and-derived-descriptions
Open

velis74 wants to merge 3 commits into
mainfrom
openapi-pk-default-and-derived-descriptions

Conversation

@velis74

@velis74 velis74 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Patch release 0.15.4.

  • A path, query or header parameter declared with its Param as the default (pk: int = Path(description=...)) is rewritten to the Annotated form before routing. A pk declared that way no longer fails at import ("Path parameters cannot have default values"), keeps its own description, and @endpoint_docs parameters finds it by name. The wrapper's parameters are keyword-only, so a required parameter may follow one with a default.
  • A model parameter annotated Form() or Body() is the request body; it was expanded into query parameters like a filter model. Only Query() and FilterParam() make a model a query parameter.
  • <Model>NoPK and <Model>Partial carry the model's docstring as their description.
  • Docs: guide/endpoint-docs.md.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

✅ Incremental coverage — 100%

████████████████████ 17 / 17 changed lines covered · threshold 70% · main → openapi-pk-default-and-derived-descriptions

File Coverage Covered Uncovered lines
✅ fastapi_viewsets/decorators/primary_key_model_helper.py 100% 1 / 1 —
✅ fastapi_viewsets/decorators/route_viewset.py 100% 16 / 16 —
Total 100% 17 / 17
8 files not graded (2 ignored by pattern, 6 not source files)
File Reason
changelog.md not a source file
docs/guide/endpoint-docs.md not a source file
fastapi_viewsets/decorators/celery_viewset/transport_test.py ignored by *_test.py
fastapi_viewsets/endpoint_docs_test.py ignored by *_test.py
package-lock.json not a source file
package.json not a source file
pyproject.toml not a source file
uv.lock not a source file

Coverage reports: coverage.json (coverage.py, 69 files) · coverage/clover.xml (clover, 13 files) — incremental-coverage-check v3.0.0

@velis74 velis74 changed the title Param defaults as Annotated parameters; descriptions of derived bodies Param defaults and Form/Body models as FastAPI declares them; descriptions of derived bodies Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant