Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for author_id (0.04 sec)

  1. docs_src/dataclasses_/tutorial003_py310.py

    @dataclass
    class Author:
        name: str
        items: list[Item] = field(default_factory=list)  # (3)
    
    
    app = FastAPI()
    
    
    @app.post("/authors/{author_id}/items/", response_model=Author)  # (4)
    async def create_author_items(author_id: str, items: list[Item]):  # (5)
        return {"name": author_id, "items": items}  # (6)
    
    
    @app.get("/authors/", response_model=list[Author])  # (7)
    def get_authors():  # (8)
        return [  # (9)
            {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.3K bytes
    - Viewed (0)
  2. docs_src/dataclasses_/tutorial003_py39.py

    @dataclass
    class Author:
        name: str
        items: list[Item] = field(default_factory=list)  # (3)
    
    
    app = FastAPI()
    
    
    @app.post("/authors/{author_id}/items/", response_model=Author)  # (4)
    async def create_author_items(author_id: str, items: list[Item]):  # (5)
        return {"name": author_id, "items": items}  # (6)
    
    
    @app.get("/authors/", response_model=list[Author])  # (7)
    def get_authors():  # (8)
        return [  # (9)
            {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 1.4K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_dataclasses/test_tutorial003.py

        assert response.status_code == 200
        assert response.json() == {
            "openapi": "3.1.0",
            "info": {"title": "FastAPI", "version": "0.1.0"},
            "paths": {
                "/authors/{author_id}/items/": {
                    "post": {
                        "summary": "Create Author Items",
                        "operationId": "create_author_items_authors__author_id__items__post",
                        "parameters": [
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 7.1K bytes
    - Viewed (0)
Back to top