Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 1,041 for model (0.02 sec)

  1. tests/test_response_model_include_exclude.py

        return Model2(
            ref=Model1(foo="simple_include model foo", bar="simple_include model bar"),
            baz="simple_include model2 baz",
        )
    
    
    @app.get(
        "/simple_include_dict",
        response_model=Model2,
        response_model_include={"baz": ..., "ref": {"foo"}},
    )
    def simple_include_dict():
        return {
            "ref": {
                "foo": "simple_include_dict model foo",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Jul 19 19:14:58 UTC 2021
    - 4K bytes
    - Viewed (0)
  2. 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():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/query-param-models.md

    # Query Parameter Models
    
    If you have a group of **query parameters** that are related, you can create a **Pydantic model** to declare them.
    
    This would allow you to **re-use the model** in **multiple places** and also to declare validations and metadata for all the parameters at once. 😎
    
    /// note
    
    This is supported since FastAPI version `0.115.0`. 🤓
    
    ///
    
    ## Query Parameters with a Pydantic Model
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.8K bytes
    - Viewed (0)
  4. tests/test_filter_pydantic_sub_model/test_filter_pydantic_sub_model_pv1.py

        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
    def test_validator_is_cloned(client: TestClient):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.5K bytes
    - Viewed (0)
  5. docs_src/sql_databases_peewee/sql_app/models.py

    import peewee
    
    from .database import db
    
    
    class User(peewee.Model):
        email = peewee.CharField(unique=True, index=True)
        hashed_password = peewee.CharField()
        is_active = peewee.BooleanField(default=True)
    
        class Meta:
            database = db
    
    
    class Item(peewee.Model):
        title = peewee.CharField(index=True)
        description = peewee.CharField(index=True)
        owner = peewee.ForeignKeyField(User, backref="items")
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 465 bytes
    - Viewed (0)
  6. tests/test_filter_pydantic_sub_model_pv2.py

        response = client.get("/model/modelA")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "modelA",
            "description": "model-a-desc",
            "foo": {"username": "test-user"},
        }
    
    
    @needs_pydanticv2
    def test_validator_is_cloned(client: TestClient):
        with pytest.raises(ResponseValidationError) as err:
            client.get("/model/modelX")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  7. compat/maven-model-builder/pom.xml

                  <exclude>org.apache.maven.model.composition.DefaultDependencyManagementImporter#importManagement(org.apache.maven.model.Model,java.util.List,org.apache.maven.model.building.ModelBuildingRequest,org.apache.maven.model.building.Mo...
    Registered: Sun Nov 03 03:35:11 UTC 2024
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 12.4K bytes
    - Viewed (0)
  8. compat/maven-model-builder/src/test/java/org/apache/maven/model/building/BuildModelSourceTransformerTest.java

            Model initial = new Model(org.apache.maven.api.model.Model.newBuilder()
                    .parent(org.apache.maven.api.model.Parent.newBuilder()
                            .groupId("GROUPID")
                            .artifactId("ARTIFACTID")
                            .build())
                    .build());
            Model expected = new Model(org.apache.maven.api.model.Model.newBuilder()
    Registered: Sun Nov 03 03:35:11 UTC 2024
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  9. 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.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  10. compat/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java

         */
        default org.apache.maven.api.model.Model injectProfile(
                org.apache.maven.api.model.Model model,
                org.apache.maven.api.model.Profile profile,
                ModelBuildingRequest request,
                ModelProblemCollector problems) {
            Model m = new Model(model);
            injectProfile(m, profile != null ? new Profile(profile) : null, request, problems);
    Registered: Sun Nov 03 03:35:11 UTC 2024
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 4.3K bytes
    - Viewed (0)
Back to top