Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for BaseModel (0.1 sec)

  1. docs/en/docs/tutorial/body.md

    ///
    
    ## Import Pydantic's `BaseModel`
    
    First, you need to import `BaseModel` from `pydantic`:
    
    {* ../../docs_src/body/tutorial001_py310.py hl[2] *}
    
    ## Create your data model
    
    Then you declare your data model as a class that inherits from `BaseModel`.
    
    Use standard Python types for all the attributes:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 16:58:19 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  2. docs/fr/docs/tutorial/body.md

    ///
    
    ## Importez le `BaseModel` de Pydantic
    
    Commencez par importer la classe `BaseModel` du module `pydantic` :
    
    {* ../../docs_src/body/tutorial001.py hl[4] *}
    
    ## Créez votre modèle de données
    
    Déclarez ensuite votre modèle de données en tant que classe qui hérite de `BaseModel`.
    
    Utilisez les types Python standard pour tous les attributs :
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 17:34:41 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  3. fastapi/dependencies/utils.py

            return True
        # If it's a Form (or File) field, it has to be a BaseModel to be top level
        # otherwise it has to be embedded, so that the key value pair can be extracted
        if isinstance(first_field.field_info, params.Form) and not lenient_issubclass(
            first_field.type_, BaseModel
        ):
            return True
        return False
    
    
    async def _extract_form_body(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 21:46:26 UTC 2024
    - 34.7K bytes
    - Viewed (0)
  4. docs/pt/docs/advanced/dataclasses.md

    {!../../docs_src/dataclasses/tutorial001.py!}
    ```
    
    Isso ainda é suportado graças ao **Pydantic**, pois ele tem <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">suporte interno para `dataclasses`</a>.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Oct 22 17:33:53 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/dataclasses.md

    {* ../../docs_src/dataclasses/tutorial001.py hl[1,7:12,19:20] *}
    
    This is still supported thanks to **Pydantic**, as it has <a href="https://docs.pydantic.dev/latest/concepts/dataclasses/#use-of-stdlib-dataclasses-with-basemodel" class="external-link" target="_blank">internal support for `dataclasses`</a>.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 28 10:35:06 UTC 2024
    - 4K bytes
    - Viewed (0)
  6. README.md

    Declare the body using standard Python types, thanks to Pydantic.
    
    ```Python hl_lines="4  9-12  25-27"
    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: float
        is_offer: Union[bool, None] = None
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Oct 31 09:13:26 UTC 2024
    - 23.6K bytes
    - Viewed (0)
  7. docs/en/docs/release-notes.md

    Use Pydantic models for `Query` parameters:
    
    ```python
    from typing import Annotated, Literal
    
    from fastapi import FastAPI, Query
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    
    class FilterParams(BaseModel):
        limit: int = Field(100, gt=0, le=100)
        offset: int = Field(0, ge=0)
        order_by: Literal["created_at", "updated_at"] = "created_at"
        tags: list[str] = []
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Nov 01 11:25:57 UTC 2024
    - 460.3K bytes
    - Viewed (0)
Back to top