Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 201 - 210 of 282 for BaseModel (0.05 seconds)

The search processing time has exceeded the limit. The displayed results may be partial.

  1. tests/test_get_model_definitions_formfeed_escape.py

    def client_fixture() -> TestClient:
        from pydantic import BaseModel
    
        class Address(BaseModel):
            """
            This is a public description of an Address
            \f
            You can't see this part of the docstring, it's private!
            """
    
            line_1: str
            city: str
            state_province: str
    
        class Facility(BaseModel):
            id: str
            address: Address
    
        app = FastAPI()
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 12:54:56 GMT 2025
    - 5.8K bytes
    - Click Count (0)
  2. docs_src/path_operation_configuration/tutorial002_py310.py

    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: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 537 bytes
    - Click Count (0)
  3. tests/test_response_by_alias.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, ConfigDict, Field
    
    app = FastAPI()
    
    
    class Model(BaseModel):
        name: str = Field(alias="alias")
    
    
    class ModelNoAlias(BaseModel):
        name: str
    
        model_config = ConfigDict(
            json_schema_extra={
                "description": (
                    "response_model_by_alias=False is basically a quick hack, to support "
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 20 15:55:38 GMT 2025
    - 10.7K bytes
    - Click Count (0)
  4. docs/pt/docs/tutorial/body.md

    ///
    
    ## Importe o `BaseModel` do Pydantic { #import-pydantics-basemodel }
    
    Primeiro, você precisa importar `BaseModel` do `pydantic`:
    
    {* ../../docs_src/body/tutorial001_py310.py hl[2] *}
    
    ## Crie seu modelo de dados { #create-your-data-model }
    
    Então você declara seu modelo de dados como uma classe que herda `BaseModel`.
    
    Utilize os tipos Python padrão para todos os atributos:
    
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 7.9K bytes
    - Click Count (0)
  5. docs_src/additional_responses/tutorial002_py310.py

    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 10 08:55:32 GMT 2025
    - 596 bytes
    - Click Count (0)
  6. docs_src/path_operation_configuration/tutorial003_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
    
    
    @app.post(
        "/items/",
        response_model=Item,
        summary="Create an item",
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 512 bytes
    - Click Count (0)
  7. docs_src/schema_extra_example/tutorial004_py39.py

    from typing import Union
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item = Body(
            examples=[
                {
                    "name": "Foo",
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 824 bytes
    - Click Count (0)
  8. docs_src/body_fields/tutorial001_py39.py

    from typing import Union
    
    from fastapi import Body, FastAPI
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = Field(
            default=None, title="The description of the item", max_length=300
        )
        price: float = Field(gt=0, description="The price must be greater than zero")
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 561 bytes
    - Click Count (0)
  9. docs_src/body_multiple_params/tutorial001_py310.py

    from fastapi import FastAPI, Path
    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 = Path(title="The ID of the item to get", ge=0, le=1000),
        q: str | None = None,
        item: Item | None = None,
    ):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 546 bytes
    - Click Count (0)
  10. docs_src/security/tutorial002_py310.py

    from fastapi import Depends, FastAPI
    from fastapi.security import OAuth2PasswordBearer
    from pydantic import BaseModel
    
    app = FastAPI()
    
    oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
    
    
    class User(BaseModel):
        username: str
        email: str | None = None
        full_name: str | None = None
        disabled: bool | None = None
    
    
    def fake_decode_token(token):
        return User(
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 711 bytes
    - Click Count (0)
Back to Top