Runtime JSON value type with strict validation and minimal OpenAPI schema.
Validation delegates to the strict JSON union, while
JSON schema is deliberately inlined as {} to avoid a named component.
Source code in jsonpatchx/types.py
| class JSONValue:
"""
Runtime JSON value type with strict validation and minimal OpenAPI schema.
Validation delegates to the strict JSON union, while
JSON schema is deliberately inlined as ``{}`` to avoid a named component.
"""
@classmethod
def __get_pydantic_core_schema__(
cls, _source_type: object, _handler: core_schema.GetCoreSchemaHandler
) -> core_schema.CoreSchema:
type _JSONValueInternal = Annotated[
JSONBoolean
| JSONNumber
| JSONString
| JSONNull
| JSONArray[_JSONValueInternal]
| JSONObject[_JSONValueInternal],
Field(),
]
return _strict_validator(_JSONValueInternal)
@classmethod
def __get_pydantic_json_schema__(
cls,
_core_schema: core_schema.CoreSchema,
_handler: core_schema.GetJsonSchemaHandler,
) -> dict[str, object]:
return {}
|