mirror of
https://github.com/kennethreitz/responder.git
synced 2026-06-05 23:00:17 +00:00
1bfd85b003
Define your API schemas with Pydantic models instead of (or alongside)
YAML docstrings and marshmallow:
from pydantic import BaseModel
class PetIn(BaseModel):
name: str
age: int = 0
class PetOut(BaseModel):
id: int
name: str
age: int
@api.route("/pets", methods=["POST"],
request_model=PetIn, response_model=PetOut)
async def create_pet(req, resp):
data = await req.media()
resp.media = {"id": 1, **data}
Also works with @api.schema("Name") decorator for registering
standalone schema components.
Pydantic models, marshmallow schemas, and YAML docstrings can all
be used together in the same API.
Also: rewrite docs with more prose, restore sidebar logo and links,
add FastAPI acknowledgment, update homepage copy.
161 tests, 95% coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
15 lines
512 B
HTML
15 lines
512 B
HTML
<p class="logo">
|
|
<a href="{{ pathto(master_doc) }}">
|
|
<img class="logo" src="{{ pathto('_static/responder.png', 1) }}" />
|
|
</a>
|
|
</p>
|
|
<p>
|
|
<strong>Responder</strong> — a familiar HTTP service framework for Python.
|
|
</p>
|
|
<h3>Useful Links</h3>
|
|
<ul>
|
|
<li><a href="https://github.com/kennethreitz/responder">Responder @ GitHub</a></li>
|
|
<li><a href="https://pypi.org/project/responder/">Responder @ PyPI</a></li>
|
|
<li><a href="https://github.com/kennethreitz/responder/issues">Issue Tracker</a></li>
|
|
</ul>
|