mirror of https://github.com/tiangolo/fastapi.git
Only check computed fields if separate_input_output_schemas is False
This commit is contained in:
parent
62dc326d22
commit
7a4f8ca675
|
|
@ -200,11 +200,13 @@ def get_schema_from_model_field(
|
||||||
],
|
],
|
||||||
separate_input_output_schemas: bool = True,
|
separate_input_output_schemas: bool = True,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
override_mode: Union[Literal["validation"], None] = (
|
override_mode: Union[Literal["validation"], None] = None
|
||||||
None
|
if not separate_input_output_schemas:
|
||||||
if (separate_input_output_schemas or _has_computed_fields(field))
|
override_mode = (
|
||||||
else "validation"
|
None
|
||||||
)
|
if (separate_input_output_schemas or _has_computed_fields(field))
|
||||||
|
else "validation"
|
||||||
|
)
|
||||||
# This expects that GenerateJsonSchema was already used to generate the definitions
|
# This expects that GenerateJsonSchema was already used to generate the definitions
|
||||||
json_schema = field_mapping[(field, override_mode or field.mode)]
|
json_schema = field_mapping[(field, override_mode or field.mode)]
|
||||||
if "$ref" not in json_schema:
|
if "$ref" not in json_schema:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue