Diego Rodriguez
23 hours ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
2 additions and
3 deletions
-
fastapi/dependencies/utils.py
-
fastapi/utils.py
|
|
@ -966,7 +966,7 @@ def get_body_field( |
|
|
|
first_param = flat_dependant.body_params[0] |
|
|
|
if not embed_body_fields: |
|
|
|
return first_param |
|
|
|
model_name = "Body_" + name |
|
|
|
model_name = f"Body_{name}" |
|
|
|
BodyModel = create_body_model( |
|
|
|
fields=flat_dependant.body_params, model_name=model_name |
|
|
|
) |
|
|
|
|
|
@ -71,7 +71,6 @@ def create_model_field( |
|
|
|
alias: Optional[str] = None, |
|
|
|
mode: Literal["validation", "serialization"] = "validation", |
|
|
|
) -> ModelField: |
|
|
|
class_validators = class_validators or {} |
|
|
|
if PYDANTIC_V2: |
|
|
|
field_info = field_info or FieldInfo( |
|
|
|
annotation=type_, default=default, alias=alias |
|
|
@ -85,7 +84,7 @@ def create_model_field( |
|
|
|
kwargs.update( |
|
|
|
{ |
|
|
|
"type_": type_, |
|
|
|
"class_validators": class_validators, |
|
|
|
"class_validators": class_validators or {}, |
|
|
|
"default": default, |
|
|
|
"required": required, |
|
|
|
"model_config": model_config, |
|
|
|