You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This is my schemaschema= {
"type": "object",
"properties": {
"pid": {"type": "integer", "error": (4001, "pid error")},
"email": {"type": "string", "error": (4002, "email error")},
...
},
"required": ["pid", "email", ...]
}
# This is how I process the errorsmy_data= {
"pid": 1,
"email": "[email protected]"
}
v=Draft7Validator(schema)
err_list= []
forerrorinv.iter_errors(my_data):
err_list.append(error.schema["error"])
print(err_list)
My requirement is to get all validation errors, so I used iter_errors to get them.
But I only can retrieve the error field that I defined myself when the pid has data but the wrong type. I can not get the custom error field if I don't post pid in my_data.
Does anyone know the resolution? (I must add the custom error message for every field)
The text was updated successfully, but these errors were encountered:
My requirement is to get all validation errors, so I used
iter_errors
to get them.But I only can retrieve the
error
field that I defined myself when thepid
has data but the wrong type. I can not get the customerror
field if I don't postpid
inmy_data
.Does anyone know the resolution? (I must add the custom error message for every field)
The text was updated successfully, but these errors were encountered: