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

Response validation #7

Open
alongreyber opened this issue Apr 23, 2021 · 2 comments
Open

Response validation #7

alongreyber opened this issue Apr 23, 2021 · 2 comments

Comments

@alongreyber
Copy link
Contributor

This code does not throw a validation error:

Response.parse_obj(
    {"message" : []}
)

Based on my understanding this should probably throw an error because message is a dict. Let me know if I am missing something.

@patrickkwang
Copy link
Contributor

You're right, this is odd. If "message" is a non-empty list, it seems to fail validation as expected. If the value is the empty string validation passes, but non-empty strings fail. False and 0 also fail validation, so it's not just passing falsy values.

@patrickkwang
Copy link
Contributor

This is a known pydantic bug: pydantic/pydantic#1268

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

No branches or pull requests

2 participants