Open will-e-yams opened 1 month ago
When a single api call builds many objects it becomes very difficult to know which model failed to validate. Currently, we have:
ctx
input
loc
msg
type
url
But validation errors are needlessly obtuse:
{ 'type': 'string_type', 'loc': ('form_name',), 'msg': 'Input should be a valid string', 'input': None, 'url': 'https://errors.pydantic.dev/2.7/v/string_type' }
Two things of note that I think are missing:
I'm not seeing ctx being used in ValidationError, so perhaps that could be used?
ValidationError
.model_dump()
.model_dump_json()
model_construct()
Hi @will-e-yams,
Could you please provide some sort of minimal reproducible example? It's hard for us to get enough context without a runnable snippet. Thanks!
Initial Checks
Description
When a single api call builds many objects it becomes very difficult to know which model failed to validate. Currently, we have:
ctx
- An optional object which contains values required to render the error message.input
- The input provided for validation.loc
- The error's location as a list.msg
- A human-readable explanation of the error.type
- A computer-readable identifier of the error type.url
- The URL to further information about the error.But validation errors are needlessly obtuse:
Two things of note that I think are missing:
I'm not seeing
ctx
being used inValidationError
, so perhaps that could be used?Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM mode