Skip to content
New issue

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

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

Already on GitHub? # to your account

return more information when pydantic raise validation error #772

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

vincentsarago
Copy link
Member

ref #750

>> httpx -m POST http://127.0.0.1:8000/search -j '{"limit": "yo"}' 
{
    "detail": [
        {
            "type": "int_parsing",
            "loc": [
                "body",
                "limit"
            ],
            "msg": "Input should be a valid integer, unable to parse string as an integer",
            "input": "yo"
        }
    ],
    "body": {
        "limit": "yo"
    }
}

>> httpx -m GET http://127.0.0.1:8000/search\?limit\=yo
{
    "detail": [
        {
            "type": "int_parsing",
            "loc": [
                "query",
                "limit"
            ],
            "msg": "Input should be a valid integer, unable to parse string as an integer",
            "input": "yo"
        }
    ],
    "body": null
}

@drnextgis is that better ?

@vincentsarago vincentsarago marked this pull request as ready for review January 7, 2025 16:05
@drnextgis
Copy link
Contributor

That is definitely much better!

@vincentsarago vincentsarago merged commit d2eb81d into main Jan 7, 2025
8 checks passed
@vincentsarago vincentsarago deleted the patch/verbose-validation-error branch January 7, 2025 16:52
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants