Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 351 - 360 of 714 for pydantic (0.04 seconds)

  1. docs_src/schema_extra_example/tutorial004_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
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item = Body(
            examples=[
                {
                    "name": "Foo",
                    "description": "A very nice Item",
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Jul 01 16:43:29 GMT 2023
    - 786 bytes
    - Click Count (0)
  2. docs_src/openapi_webhooks/tutorial001_py39.py

    from datetime import datetime
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Subscription(BaseModel):
        username: str
        monthly_fee: float
        start_date: datetime
    
    
    @app.webhooks.post("new-subscription")
    def new_subscription(body: Subscription):
        """
        When a new user subscribes to your service we'll send you a POST request with this
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 550 bytes
    - Click Count (0)
  3. docs/uk/docs/python-types.md

    {* ../../docs_src/python_types/tutorial010.py hl[6] *}
    
    
    І знову ж таки, ви отримуєте всю підтримку редактора:
    
    <img src="/img/python-types/image06.png">
    
    ## Pydantic моделі
    
    <a href="https://docs.pydantic.dev/" class="external-link" target="_blank">Pydantic</a> це бібліотека Python для валідації даних.
    
    Ви оголошуєте «форму» даних як класи з атрибутами.
    
    І кожен атрибут має тип.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Mon Nov 18 02:25:44 GMT 2024
    - 19.4K bytes
    - Click Count (0)
  4. docs/zh/docs/python-types.md

    <img src="https://fastapi.tiangolo.com/img/python-types/image06.png">
    
    ## Pydantic 模型
    
    <a href="https://docs.pydantic.dev/" class="external-link" target="_blank">Pydantic</a> 是一个用来执行数据校验的 Python 库。
    
    你可以将数据的"结构"声明为具有属性的类。
    
    每个属性都拥有类型。
    
    接着你用一些值来创建这个类的实例,这些值会被校验,并被转换为适当的类型(在需要的情况下),返回一个包含所有数据的对象。
    
    然后,你将获得这个对象的所有编辑器支持。
    
    下面的例子来自 Pydantic 官方文档:
    
    //// tab | Python 3.10+
    
    ```Python
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Mon Aug 18 06:34:40 GMT 2025
    - 8.6K bytes
    - Click Count (0)
  5. docs/pt/docs/tutorial/query-params-str-validations.md

    Agora você sabe que, sempre que precisar delas, pode usá-las no **FastAPI**.
    
    ### Pydantic v1 `regex` em vez de `pattern` { #pydantic-v1-regex-instead-of-pattern }
    
    Antes da versão 2 do Pydantic e antes do FastAPI 0.100.0, o parâmetro se chamava `regex` em vez de `pattern`, mas agora está descontinuado.
    
    Você ainda pode ver algum código usando isso:
    
    //// tab | Pydantic v1
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 18.2K bytes
    - Click Count (0)
  6. docs/en/docs/reference/openapi/models.md

    # OpenAPI `models`
    
    OpenAPI Pydantic models used to generate and validate the generated OpenAPI.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 125 bytes
    - Click Count (0)
  7. docs_src/additional_responses/tutorial002_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.responses import FileResponse
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        id: str
        value: str
    
    
    app = FastAPI()
    
    
    @app.get(
        "/items/{item_id}",
        response_model=Item,
        responses={
            200: {
                "content": {"image/png": {}},
                "description": "Return the JSON item or an image.",
            }
        },
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 628 bytes
    - Click Count (0)
  8. docs_src/schema_extra_example/tutorial004_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(
                examples=[
                    {
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Jul 01 16:43:29 GMT 2023
    - 917 bytes
    - Click Count (0)
  9. docs/en/docs/advanced/response-directly.md

    # Return a Response Directly { #return-a-response-directly }
    
    When you create a **FastAPI** *path operation* you can normally return any data from it: a `dict`, a `list`, a Pydantic model, a database model, etc.
    
    By default, **FastAPI** would automatically convert that return value to JSON using the `jsonable_encoder` explained in [JSON Compatible Encoder](../tutorial/encoder.md){.internal-link target=_blank}.
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 3.1K bytes
    - Click Count (0)
  10. docs_src/extra_models/tutorial003_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class BaseItem(BaseModel):
        description: str
        type: str
    
    
    class CarItem(BaseItem):
        type: str = "car"
    
    
    class PlaneItem(BaseItem):
        type: str = "plane"
        size: int
    
    
    items = {
        "item1": {"description": "All my friends drive a low rider", "type": "car"},
        "item2": {
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 644 bytes
    - Click Count (0)
Back to Top