MCPcopy
hub / github.com/fastapi/fastapi / validate

Method validate

fastapi/_compat/v2.py:173–188  ·  view source on GitHub ↗
(
        self,
        value: Any,
        values: dict[str, Any] = {},  # noqa: B006
        *,
        loc: tuple[int | str, ...] = (),
    )

Source from the content-addressed store, hash-verified

171 return self.field_info.get_default(call_default_factory=True)
172
173 def validate(
174 self,
175 value: Any,
176 values: dict[str, Any] = {}, # noqa: B006
177 *,
178 loc: tuple[int | str, ...] = (),
179 ) -> tuple[Any, list[dict[str, Any]]]:
180 try:
181 return (
182 self._type_adapter.validate_python(value, from_attributes=True),
183 [],
184 )
185 except ValidationError as exc:
186 return None, _regenerate_error_with_loc(
187 errors=exc.errors(include_url=False), loc_prefix=loc
188 )
189
190 def serialize(
191 self,

Callers 3

serialize_responseFunction · 0.45
_serialize_dataFunction · 0.45

Calls 2

errorsMethod · 0.80

Tested by

no test coverage detected