Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 500 for name (0.14 sec)

  1. tests/test_filter_pydantic_sub_model_pv2.py

            def lower_username(cls, name: str, info: ValidationInfo):
                if not name.endswith("A"):
                    raise ValueError("name must end in A")
                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 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 6.3K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_dependencies/test_tutorial004_an_py39.py

                        {"item_name": "Foo"},
                        {"item_name": "Bar"},
                        {"item_name": "Baz"},
                    ]
                },
            ),
            (
                "/items?q=foo",
                200,
                {
                    "items": [
                        {"item_name": "Foo"},
                        {"item_name": "Bar"},
                        {"item_name": "Baz"},
                    ],
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 5.6K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_response_model/test_tutorial005_py310.py

    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.response_model.tutorial005_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_read_item_name(client: TestClient):
        response = client.get("/items/bar/name")
        assert response.status_code == 200, response.text
        assert response.json() == {"name": "Bar", "description": "The Bar fighters"}
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Aug 04 20:47:07 GMT 2023
    - 6.2K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_response_model/test_tutorial005.py

                        },
                        "summary": "Read Item Name",
                        "operationId": "read_item_name_items__item_id__name_get",
                        "parameters": [
                            {
                                "required": True,
                                "schema": {"title": "Item Id", "type": "string"},
                                "name": "item_id",
                                "in": "path",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Aug 04 20:47:07 GMT 2023
    - 6K bytes
    - Viewed (0)
  5. docs_src/additional_status_codes/tutorial001.py

    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Union[str, None] = Body(default=None),
        size: Union[int, None] = Body(default=None),
    ):
        if item_id in items:
            item = items[item_id]
            item["name"] = name
            item["size"] = size
            return item
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 684 bytes
    - Viewed (0)
  6. tests/test_validate_response_recursive/test_validate_response_recursive_pv1.py

        assert response.json() == {
            "sub_items": [{"name": "subitem", "sub_items": []}],
            "name": "item",
        }
    
        response = client.get("/items/recursive-submodel")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "item",
            "sub_items1": [
                {
                    "name": "subitem",
                    "sub_items2": [
                        {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 900 bytes
    - Viewed (0)
  7. tests/test_validate_response_recursive/test_validate_response_recursive_pv2.py

        assert response.json() == {
            "sub_items": [{"name": "subitem", "sub_items": []}],
            "name": "item",
        }
    
        response = client.get("/items/recursive-submodel")
        assert response.status_code == 200, response.text
        assert response.json() == {
            "name": "item",
            "sub_items1": [
                {
                    "name": "subitem",
                    "sub_items2": [
                        {
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 900 bytes
    - Viewed (0)
  8. tests/test_tutorial/test_path_operation_advanced_configurations/test_tutorial004.py

            "components": {
                "schemas": {
                    "Item": {
                        "title": "Item",
                        "required": ["name", "price"],
                        "type": "object",
                        "properties": {
                            "name": {"title": "Name", "type": "string"},
                            "description": {
                                "title": "Description",
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 8.7K bytes
    - Viewed (0)
  9. tests/test_validate_response_dataclass.py

    app = FastAPI()
    
    
    @dataclass
    class Item:
        name: str
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/invalid", response_model=Item)
    def get_invalid():
        return {"name": "invalid", "price": "foo"}
    
    
    @app.get("/items/innerinvalid", response_model=Item)
    def get_innerinvalid():
        return {"name": "double invalid", "price": "foo", "owner_ids": ["foo", "bar"]}
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001_py39.py

    
    @needs_py39
    def test_read_items(client: TestClient) -> None:
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [
            {
                "name": "Portal Gun",
                "description": "Device to travel through the multi-rick-verse",
            },
            {"name": "Plumbus", "description": None},
        ]
    
    
    @needs_py39
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 4.9K bytes
    - Viewed (0)
Back to top