Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 24 for json_schema (0.24 sec)

  1. tests/test_openapi_examples.py

                },
            },
        ),
    ):
        return item
    
    
    @app.get("/path_examples/{item_id}")
    def path_examples(
        item_id: str = Path(
            examples=[
                "json_schema_item_1",
                "json_schema_item_2",
            ],
            openapi_examples={
                "Path One": {
                    "summary": "Path One Summary",
                    "description": "Path One Description",
    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. fastapi/params.py

                        "strict": strict,
                        "json_schema_extra": current_json_schema_extra,
                    }
                )
                kwargs["pattern"] = pattern or regex
            else:
                kwargs["regex"] = pattern or regex
                kwargs.update(**current_json_schema_extra)
            use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset}
    
    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)
  3. fastapi/param_functions.py

            example=example,
            examples=examples,
            openapi_examples=openapi_examples,
            deprecated=deprecated,
            include_in_schema=include_in_schema,
            json_schema_extra=json_schema_extra,
            **extra,
        )
    
    
    def Query(  # noqa: N802
        default: Annotated[
            Any,
            Doc(
                """
                Default value if the parameter field is not set.
    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)
  4. fastapi/_compat.py

            json_schema = field_mapping[(field, override_mode or field.mode)]
            if "$ref" not in json_schema:
                # TODO remove when deprecating Pydantic v1
                # Ref: https://github.com/pydantic/pydantic/blob/d61792cc42c80b13b23e3ffa74bc37ec7c77f7d1/pydantic/schema.py#L207
                json_schema["title"] = (
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
  5. docs_src/schema_extra_example/tutorial001_py310.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
    
        model_config = {
            "json_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
    - 646 bytes
    - Viewed (0)
  6. docs_src/schema_extra_example/tutorial001.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
    
        model_config = {
            "json_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
    - 684 bytes
    - Viewed (0)
  7. docs_src/path_operation_advanced_configuration/tutorial007.py

    
    class Item(BaseModel):
        name: str
        tags: List[str]
    
    
    @app.post(
        "/items/",
        openapi_extra={
            "requestBody": {
                "content": {"application/x-yaml": {"schema": Item.model_json_schema()}},
                "required": True,
            },
        },
    )
    async def create_item(request: Request):
        raw_body = await request.body()
        try:
            data = yaml.safe_load(raw_body)
        except yaml.YAMLError:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 822 bytes
    - Viewed (0)
  8. tests/test_custom_schema_fields.py

    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
    
        if PYDANTIC_V2:
            model_config = {
                "json_schema_extra": {
                    "x-something-internal": {"level": 4},
                }
            }
        else:
    
            class Config:
                schema_extra = {
                    "x-something-internal": {"level": 4},
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  9. fastapi/datastructures.py

            @classmethod
            def __modify_schema__(cls, field_schema: Dict[str, Any]) -> None:
                field_schema.update({"type": "string", "format": "binary"})
    
        @classmethod
        def __get_pydantic_json_schema__(
            cls, core_schema: CoreSchema, handler: GetJsonSchemaHandler
        ) -> JsonSchemaValue:
            return {"type": "string", "format": "binary"}
    
        @classmethod
        def __get_pydantic_core_schema__(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  10. tests/test_openapi_separate_input_output_schemas.py

        sub_description: Optional[str] = None
        tags: List[str] = []
        if PYDANTIC_V2:
            model_config = {"json_schema_serialization_defaults_required": True}
    
    
    class Item(BaseModel):
        name: str
        description: Optional[str] = None
        sub: Optional[SubItem] = None
        if PYDANTIC_V2:
            model_config = {"json_schema_serialization_defaults_required": True}
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 18.4K bytes
    - Viewed (2)
Back to top