Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 28 for Elias (0.12 sec)

  1. tests/test_repeated_parameter_alias.py

    app = FastAPI()
    
    
    @app.get("/{repeated_alias}")
    def get_parameters_with_repeated_aliases(
        path: str = Path(..., alias="repeated_alias"),
        query: str = Query(..., alias="repeated_alias"),
    ):
        return {"path": path, "query": query}
    
    
    client = TestClient(app)
    
    
    def test_get_parameters():
        response = client.get("/test_path", params={"repeated_alias": "test_query"})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.7K bytes
    - Viewed (0)
  2. fastapi/utils.py

                        f, cloned_types=cloned_types
                    )
        new_field = create_response_field(name=field.name, type_=use_type)
        new_field.has_alias = field.has_alias  # type: ignore[attr-defined]
        new_field.alias = field.alias  # type: ignore[misc]
        new_field.class_validators = field.class_validators  # type: ignore[attr-defined]
        new_field.default = field.default  # type: ignore[misc]
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial009_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str | None, Query(alias="item-query")] = None):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 314 bytes
    - Viewed (0)
  4. docs_src/query_params_str_validations/tutorial009.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Union[str, None] = Query(default=None, alias="item-query")):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 313 bytes
    - Viewed (0)
  5. docs_src/path_params_numeric_validations/tutorial001_an.py

    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_items(
        item_id: Annotated[int, Path(title="The ID of the item to get")],
        q: Annotated[Union[str, None], Query(alias="item-query")] = None,
    ):
        results = {"item_id": item_id}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 417 bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial010.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Union[str, None] = Query(
            default=None,
            alias="item-query",
            title="Query string",
            description="Query string for the items to search in the database that have a good match",
            min_length=3,
            max_length=50,
            pattern="^fixedquery$",
            deprecated=True,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 574 bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/response-model.md

    !!! tip
        但是依然建议你使用上面提到的主意,使用多个类而不是这些参数。
    
        这是因为即使使用 `response_model_include` 或 `response_model_exclude` 来省略某些属性,在应用程序的 OpenAPI 定义(和文档)中生成的 JSON Schema 仍将是完整的模型。
    
        这也适用于作用类似的 `response_model_by_alias`。
    
    ```Python hl_lines="31  37"
    {!../../../docs_src/response_model/tutorial005.py!}
    ```
    
    !!! tip
        `{"name", "description"}` 语法创建一个具有这两个值的 `set`。
    
        等同于 `set(["name", "description"])`。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 7.9K bytes
    - Viewed (0)
  8. docs/ja/docs/tutorial/response-model.md

        それでも、これらのパラメータではなく、複数のクラスを使用して、上記のようなアイデアを使うことをおすすめします。
    
        これは`response_model_include`や`response_mode_exclude`を使用していくつかの属性を省略しても、アプリケーションのOpenAPI(とドキュメント)で生成されたJSON Schemaが完全なモデルになるからです。
    
        同様に動作する`response_model_by_alias`にも当てはまります。
    
    ```Python hl_lines="31 37"
    {!../../../docs_src/response_model/tutorial005.py!}
    ```
    
    !!! tip "豆知識"
        `{"name", "description"}`の構文はこれら2つの値をもつ`set`を作成します。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  9. docs/pt/docs/tutorial/query-params-str-validations.md

    O que mais se aproxima é `item_query`.
    
    Mas ainda você precisa que o nome seja exatamente `item-query`...
    
    Então você pode declarar um `alias`, e esse apelido (alias) que será utilizado para encontrar o valor do parâmetro:
    
    ```Python hl_lines="9"
    {!../../../docs_src/query_params_str_validations/tutorial009.py!}
    ```
    
    ## Parâmetros descontinuados
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 9.3K bytes
    - Viewed (0)
  10. docs_src/query_params_str_validations/tutorial009_py310.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: str | None = Query(default=None, alias="item-query")):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 281 bytes
    - Viewed (0)
Back to top