Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better parse pydantic validation errors #300

Open
russbiggs opened this issue Oct 4, 2023 · 0 comments
Open

better parse pydantic validation errors #300

russbiggs opened this issue Oct 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@russbiggs
Copy link
Member

specifically in v3 we have must more validation set for query parameters but with pydantic v2 the behavior has changes in how its returns the validation error when serving a 422 e.g.

https://api.openaq.org/v3/locations?limit=100000

will return:

{
    "detail": [
        {
            "type": "less_than_equal",
             "loc": [
                 "query",
                 "limit"
              ],
             "msg": "Input should be less than or equal to 1000",
             "input": 100000,
             "ctx": {
                 "le": 1000
              },
             "url": "https://errors.pydantic.dev/2.1.2/v/less_than_equal"
       }
   ]
}

Most of the content is informative but coudl likely be better parsed and displayed for users in a way that does not expose the underlying pydantic implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant