Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 51 - 60 of 128 for Tax (0.35 seconds)

  1. docs/en/docs/tutorial/response-model.md

    ```Python hl_lines="3  5-6"
    {
        "name": "Baz",
        "description": None,
        "price": 50.2,
        "tax": 10.5,
        "tags": []
    }
    ```
    
    FastAPI is smart enough (actually, Pydantic is smart enough) to realize that, even though `description`, `tax`, and `tags` have the same values as the defaults, they were set explicitly (instead of taken from the defaults).
    
    So, they will be included in the JSON response.
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 15.5K bytes
    - Click Count (0)
  2. docs/zh/docs/tutorial/body-updates.md

    ### 关于替换的警告 { #warning-about-replacing }
    
    用 `PUT` 把数据项 `bar` 更新为以下请求体时:
    
    ```Python
    {
        "name": "Barz",
        "price": 3,
        "description": None,
    }
    ```
    
    因为其中未包含已存储的属性 `"tax": 20.2`,输入模型会取 `"tax": 10.5` 的默认值。
    
    因此,保存的数据会带有这个“新的” `tax` 值 `10.5`。
    
    ## 用 `PATCH` 进行部分更新 { #partial-updates-with-patch }
    
    也可以使用 [HTTP `PATCH`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) 操作对数据进行*部分*更新。
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 3.7K bytes
    - Click Count (0)
  3. docs/zh/docs/tutorial/body.md

    例如,上述模型声明如下 JSON "object"(即 Python `dict`):
    
    ```JSON
    {
        "name": "Foo",
        "description": "An optional description",
        "price": 45.2,
        "tax": 3.5
    }
    ```
    
    ...由于 `description` 和 `tax` 是可选的(默认值为 `None`),下面的 JSON "object" 也有效:
    
    ```JSON
    {
        "name": "Foo",
        "price": 45.2
    }
    ```
    
    ## 声明为参数 { #declare-it-as-a-parameter }
    
    使用与声明路径和查询参数相同的方式,把它添加至*路径操作*:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 5.9K bytes
    - Click Count (0)
  4. docs_src/body/tutorial001_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    async def create_item(item: Item):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 271 bytes
    - Click Count (0)
  5. docs_src/dataclasses_/tutorial001_py310.py

    from dataclasses import dataclass
    
    from fastapi import FastAPI
    
    
    @dataclass
    class Item:
        name: str
        price: float
        description: str | None = None
        tax: float | None = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    async def create_item(item: Item):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 275 bytes
    - Click Count (0)
  6. docs_src/body_multiple_params/tutorial005_an_py310.py

    from typing import Annotated
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Annotated[Item, Body(embed=True)]):
        results = {"item_id": item_id, "item": item}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 409 bytes
    - Click Count (0)
  7. docs_src/body_multiple_params/tutorial003_py310.py

    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    class User(BaseModel):
        username: str
        full_name: str | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item, user: User, importance: int = Body()):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 504 bytes
    - Click Count (0)
  8. docs_src/response_model/tutorial001_py310.py

    from typing import Any
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: list[str] = []
    
    
    @app.post("/items/", response_model=Item)
    async def create_item(item: Item) -> Any:
        return item
    
    
    @app.get("/items/", response_model=list[Item])
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Jan 07 13:45:48 GMT 2023
    - 537 bytes
    - Click Count (0)
  9. docs/ko/docs/tutorial/body-nested-models.md

    {* ../../docs_src/body_nested_models/tutorial004_py310.py hl[18] *}
    
    이는 **FastAPI**가 다음과 유사한 본문을 기대한다는 것을 의미합니다:
    
    ```JSON
    {
        "name": "Foo",
        "description": "The pretender",
        "price": 42.0,
        "tax": 3.2,
        "tags": ["rock", "metal", "bar"],
        "image": {
            "url": "http://example.com/baz.jpg",
            "name": "The Foo live"
        }
    }
    ```
    
    다시 한번, **FastAPI**로 그 선언만 해도 얻는 것은:
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 7.7K bytes
    - Click Count (0)
  10. docs/zh-hant/docs/tutorial/body-nested-models.md

    然後把它作為某個屬性的型別使用:
    
    {* ../../docs_src/body_nested_models/tutorial004_py310.py hl[18] *}
    
    這表示 **FastAPI** 會期望一個類似如下的本文:
    
    ```JSON
    {
        "name": "Foo",
        "description": "The pretender",
        "price": 42.0,
        "tax": 3.2,
        "tags": ["rock", "metal", "bar"],
        "image": {
            "url": "http://example.com/baz.jpg",
            "name": "The Foo live"
        }
    }
    ```
    
    只需進行上述宣告,使用 **FastAPI** 你就能獲得:
    
    - 編輯器支援(自動完成等),即使是巢狀模型
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 6.5K bytes
    - Click Count (0)
Back to Top