|
@ -201,11 +201,18 @@ if PYDANTIC_V2: |
|
|
fields: List[ModelField], |
|
|
fields: List[ModelField], |
|
|
schema_generator: GenerateJsonSchema, |
|
|
schema_generator: GenerateJsonSchema, |
|
|
model_name_map: ModelNameMap, |
|
|
model_name_map: ModelNameMap, |
|
|
) -> Tuple[Dict[str, Any], Dict[str, Dict[str, Any]]]: |
|
|
) -> Tuple[ |
|
|
|
|
|
Dict[ |
|
|
|
|
|
Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue |
|
|
|
|
|
], |
|
|
|
|
|
Dict[str, Dict[str, Any]], |
|
|
|
|
|
]: |
|
|
inputs = [ |
|
|
inputs = [ |
|
|
(field, field.mode, field._type_adapter.core_schema) for field in fields |
|
|
(field, field.mode, field._type_adapter.core_schema) for field in fields |
|
|
] |
|
|
] |
|
|
field_mapping, definitions = schema_generator.generate_definitions(inputs=inputs) # type: ignore[arg-type] |
|
|
field_mapping, definitions = schema_generator.generate_definitions( |
|
|
|
|
|
inputs=inputs |
|
|
|
|
|
) |
|
|
return field_mapping, definitions # type: ignore[return-value] |
|
|
return field_mapping, definitions # type: ignore[return-value] |
|
|
|
|
|
|
|
|
def is_scalar_field(field: ModelField) -> bool: |
|
|
def is_scalar_field(field: ModelField) -> bool: |
|
@ -441,7 +448,12 @@ else: |
|
|
fields: List[ModelField], |
|
|
fields: List[ModelField], |
|
|
schema_generator: GenerateJsonSchema, |
|
|
schema_generator: GenerateJsonSchema, |
|
|
model_name_map: ModelNameMap, |
|
|
model_name_map: ModelNameMap, |
|
|
) -> Tuple[Dict[str, Any], Dict[str, Dict[str, Any]]]: |
|
|
) -> Tuple[ |
|
|
|
|
|
Dict[ |
|
|
|
|
|
Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue |
|
|
|
|
|
], |
|
|
|
|
|
Dict[str, Dict[str, Any]], |
|
|
|
|
|
]: |
|
|
models = get_flat_models_from_fields(fields, known_models=set()) |
|
|
models = get_flat_models_from_fields(fields, known_models=set()) |
|
|
return {}, get_model_definitions( |
|
|
return {}, get_model_definitions( |
|
|
flat_models=models, model_name_map=model_name_map |
|
|
flat_models=models, model_name_map=model_name_map |
|
|