Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 351 for examples (0.2 sec)

  1. tests/test_openapi_examples.py

        data: str
    
    
    @app.post("/examples/")
    def examples(
        item: Item = Body(
            examples=[
                {"data": "Data in Body examples, example1"},
            ],
            openapi_examples={
                "Example One": {
                    "summary": "Example One Summary",
                    "description": "Example One Description",
                    "value": {"data": "Data in Body examples, example1"},
                },
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 17K bytes
    - Viewed (0)
  2. tests/test_schema_extra_examples.py

                return item
    
        @app.post("/examples/")
        def examples(
            item: Item = Body(
                examples=[
                    {"data": "Data in Body examples, example1"},
                    {"data": "Data in Body examples, example2"},
                ],
            ),
        ):
            return item
    
        with pytest.warns(DeprecationWarning):
    
            @app.post("/example_examples/")
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 37.7K bytes
    - Viewed (0)
  3. fastapi/params.py

            **extra: Any,
        ):
            if example is not _Unset:
                warnings.warn(
                    "`example` has been deprecated, please use `examples` instead",
                    category=DeprecationWarning,
                    stacklevel=4,
                )
            self.example = example
            self.include_in_schema = include_in_schema
            self.openapi_examples = openapi_examples
            kwargs = dict(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 27.5K bytes
    - Viewed (1)
  4. fastapi/param_functions.py

            strict=strict,
            multiple_of=multiple_of,
            allow_inf_nan=allow_inf_nan,
            max_digits=max_digits,
            decimal_places=decimal_places,
            example=example,
            examples=examples,
            openapi_examples=openapi_examples,
            deprecated=deprecated,
            include_in_schema=include_in_schema,
            json_schema_extra=json_schema_extra,
            **extra,
        )
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 62.5K bytes
    - Viewed (0)
  5. docs/ru/docs/tutorial/schema-extra-example.md

        {!> ../../../docs_src/schema_extra_example/tutorial003.py!}
        ```
    
    ### Аргумент "example" в UI документации
    
    С любым из вышеуказанных методов это будет выглядеть так в `/docs`:
    
    <img src="/img/tutorial/body-fields/image01.png">
    
    ### `Body` с аргументом `examples`
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  6. docs/ja/docs/tutorial/schema-extra-example.md

    そのため、OpenAPIでは同じ目的のために<a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#fixed-fields-20" class="external-link" target="_blank">`example`</a>を独自に定義しており(`examples`ではなく`example`として)、それがdocs UI(Swagger UIを使用)で使用されています。
    
    つまり、`example`はJSON Schemaの一部ではありませんが、OpenAPIの一部であり、それがdocs UIで使用されることになります。
    
    ## その他の情報
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 3K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_schema_extra_example/test_tutorial004_an_py310.py

    from ...utils import needs_py310
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial004_an_py310 import app
    
        client = TestClient(app)
        return client
    
    
    # Test required and embedded body parameters with no bodies sent
    @needs_py310
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 7.1K bytes
    - Viewed (0)
  8. docs_src/schema_extra_example/tutorial003_py310.py

        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        item_id: int,
        item: Item = Body(
            examples=[
                {
                    "name": "Foo",
                    "description": "A very nice Item",
                    "price": 35.4,
                    "tax": 3.2,
                }
            ],
        ),
    ):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 574 bytes
    - Viewed (0)
  9. docs_src/schema_extra_example/tutorial001_py310_pv1.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
        class Config:
            schema_extra = {
                "examples": [
                    {
                        "name": "Foo",
                        "description": "A very nice Item",
                        "price": 35.4,
                        "tax": 3.2,
                    }
                ]
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 631 bytes
    - Viewed (0)
  10. docs_src/schema_extra_example/tutorial004_an.py

        price: float
        tax: Union[float, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Annotated[
            Item,
            Body(
                examples=[
                    {
                        "name": "Foo",
                        "description": "A very nice Item",
                        "price": 35.4,
                        "tax": 3.2,
                    },
                    {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jul 01 16:43:29 GMT 2023
    - 965 bytes
    - Viewed (0)
Back to top