Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 1,310 for model (0.24 sec)

  1. tests/test_filter_pydantic_sub_model/test_filter_pydantic_sub_model_pv1.py

        client = TestClient(app)
        return client
    
    
    @needs_pydanticv1
    def test_filter_sub_model(client: TestClient):
        response = client.get("/model/modelA")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "modelA",
            "description": "model-a-desc",
            "model_b": {"username": "test-user"},
        }
    
    
    @needs_pydanticv1
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  2. maven-core/src/test/resources/projects/child-which-inherits-from-super-model.xml

    specific language governing permissions and limitations
    under the License.
    -->
    
    <model>
      <groupId>foo</groupId>
      <artifactId>bar</artifactId>
      <name>Babar</name>
      <version>4.5</version>
    
      <!-- Build element should be inherited from the super model -->
    
    XML
    - Registered: Sun Mar 31 03:35:09 GMT 2024
    - Last Modified: Sun Nov 23 12:04:30 GMT 2014
    - 954 bytes
    - Viewed (0)
  3. tests/test_additional_responses_custom_model_in_callback.py

    
    class CustomModel(BaseModel):
        a: int
    
    
    app = FastAPI()
    
    callback_router = APIRouter(default_response_class=JSONResponse)
    
    
    @callback_router.get(
        "{$callback_url}/callback/", responses={400: {"model": CustomModel}}
    )
    def callback_route():
        pass  # pragma: no cover
    
    
    @app.post("/", callbacks=callback_router.routes)
    def main_route(callback_url: HttpUrl):
        pass  # pragma: no cover
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  4. tests/test_response_model_data_filter_no_inheritance.py

    class PetDB(BaseModel):
        name: str
        owner: UserDB
    
    
    class PetOut(BaseModel):
        name: str
        owner: User
    
    
    @app.post("/users/", response_model=User)
    async def create_user(user: UserCreate):
        return user
    
    
    @app.get("/pets/{pet_id}", response_model=PetOut)
    async def read_pet(pet_id: int):
        user = UserDB(
            email="******@****.***",
            hashed_password="secrethashed",
        )
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  5. tests/test_duplicate_models_openapi.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Model(BaseModel):
        pass
    
    
    class Model2(BaseModel):
        a: Model
    
    
    class Model3(BaseModel):
        c: Model
        d: Model2
    
    
    @app.get("/", response_model=Model3)
    def f():
        return {"c": {}, "d": {"a": {}}}
    
    
    client = TestClient(app)
    
    
    def test_get_api_route():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  6. utils/tests/models.go

    	Active    bool
    }
    
    type Account struct {
    	gorm.Model
    	UserID sql.NullInt64
    	Number string
    }
    
    type Pet struct {
    	gorm.Model
    	UserID *uint
    	Name   string
    	Toy    Toy `gorm:"polymorphic:Owner;"`
    }
    
    type Toy struct {
    	gorm.Model
    	Name      string
    	OwnerID   string
    	OwnerType string
    }
    
    type Tools struct {
    	gorm.Model
    	Name     string
    	CustomID string
    	Type     string
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  7. tests/test_filter_pydantic_sub_model/app_pv1.py

            return name
    
    
    async def get_model_c() -> ModelC:
        return ModelC(username="test-user", password="test-password")
    
    
    @app.get("/model/{name}", response_model=ModelA)
    async def get_model_a(name: str, model_c=Depends(get_model_c)):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 784 bytes
    - Viewed (0)
  8. docs_src/path_params/tutorial005.py

    
    app = FastAPI()
    
    
    @app.get("/models/{model_name}")
    async def get_model(model_name: ModelName):
        if model_name is ModelName.alexnet:
            return {"model_name": model_name, "message": "Deep Learning FTW!"}
    
        if model_name.value == "lenet":
            return {"model_name": model_name, "message": "LeCNN all the images"}
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Aug 26 13:26:03 GMT 2022
    - 546 bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/extra-models.md

        {!> ../../../docs_src/extra_models/tutorial001_py310.py!}
        ```
    
    === "Python 3.8+"
    
        ```Python hl_lines="9  11  16  22  24  29-30  33-35  40-41"
        {!> ../../../docs_src/extra_models/tutorial001.py!}
        ```
    
    !!! info
        In Pydantic v1 hieß diese Methode `.dict()`, in Pydantic v2 wurde sie deprecated (aber immer noch unterstützt) und in `.model_dump()` umbenannt.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:26:47 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/extra-models.md

    # Extra Models
    
    Continuing with the previous example, it will be common to have more than one related model.
    
    This is especially the case for user models, because:
    
    * The **input model** needs to be able to have a password.
    * The **output model** should not have a password.
    * The **database model** would probably need to have a hashed password.
    
    !!! danger
        Never store user's plaintext passwords. Always store a "secure hash" that you can then verify.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.7K bytes
    - Viewed (1)
Back to top