Home / Function/ _validate_value_with_model_field() — fastapi Function Reference

_validate_value_with_model_field() — fastapi Function Reference

Architecture documentation for the _validate_value_with_model_field() function in utils.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  af90f630_e23a_6963_9a62_0bf9e44f6742["_validate_value_with_model_field()"]
  9e602cbf_3139_86ae_5666_97b8806942de["utils.py"]
  af90f630_e23a_6963_9a62_0bf9e44f6742 -->|defined in| 9e602cbf_3139_86ae_5666_97b8806942de
  0b6a77bd_97c7_05f8_56cd_a3e6fa8af276["request_params_to_args()"]
  0b6a77bd_97c7_05f8_56cd_a3e6fa8af276 -->|calls| af90f630_e23a_6963_9a62_0bf9e44f6742
  b8125a22_3ce8_c209_1d2b_1aaf5de6f8b2["request_body_to_args()"]
  b8125a22_3ce8_c209_1d2b_1aaf5de6f8b2 -->|calls| af90f630_e23a_6963_9a62_0bf9e44f6742
  style af90f630_e23a_6963_9a62_0bf9e44f6742 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/dependencies/utils.py lines 708–716

def _validate_value_with_model_field(
    *, field: ModelField, value: Any, values: dict[str, Any], loc: tuple[str, ...]
) -> tuple[Any, list[Any]]:
    if value is None:
        if field.field_info.is_required():
            return None, [get_missing_field_error(loc=loc)]
        else:
            return deepcopy(field.default), []
    return field.validate(value, values, loc=loc)

Subdomains

Frequently Asked Questions

What does _validate_value_with_model_field() do?
_validate_value_with_model_field() is a function in the fastapi codebase, defined in fastapi/dependencies/utils.py.
Where is _validate_value_with_model_field() defined?
_validate_value_with_model_field() is defined in fastapi/dependencies/utils.py at line 708.
What calls _validate_value_with_model_field()?
_validate_value_with_model_field() is called by 2 function(s): request_body_to_args, request_params_to_args.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free