Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for WithJsonSchema (0.06 sec)

  1. tests/test_arbitrary_types.py

            BaseModel,
            ConfigDict,
            PlainSerializer,
            TypeAdapter,
            WithJsonSchema,
        )
    
        class FakeNumpyArray:
            def __init__(self):
                self.data = [1.0, 2.0, 3.0]
    
        FakeNumpyArrayPydantic = Annotated[
            FakeNumpyArray,
            WithJsonSchema(TypeAdapter(list[float]).json_schema()),
            PlainSerializer(lambda v: v.data),
        ]
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 3.8K bytes
    - Viewed (0)
  2. tests/test_custom_schema_fields.py

    from typing import Annotated, Optional
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, WithJsonSchema
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
    
        description: Annotated[
            Optional[str], WithJsonSchema({"type": ["string", "null"]})
        ] = None
    
        model_config = {
            "json_schema_extra": {
                "x-something-internal": {"level": 4},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 1.3K bytes
    - Viewed (0)
Back to top