reflect pydantic's type leniency
See original GitHub issuepydantic has lots of support for coercing types, however pydantic-pycharm-plugin current gives a message saying simply Expected type "x", got "y" instead
:
Is there any possibility to change the error message to something like Field is of type "x", "y" may not be parsable to "x"
? (or something cleaner, can’t think right now)
Perhaps it might even be possible to not show a warning in some obvious cases eg, int
or str
when the field is of type datetime
? If that’s not possible, just making the message more friendly/correct might be simplest.
I can imagine that actually trying to parse the value and see if it’ll work (eg. '1'
will work for int
but 'x'
would not) would involve duplicating the whole of pydantic’s logic in kotlin which is completely impossible. So I’m definitely not asking for that!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:10 (6 by maintainers)
Top GitHub Comments
Friendly/more correct message is definitely the best first step.
@samuelcolvin
Did you talk about
init_typed
andwarn_untyped_fields_check_box
? If I can parseini
file in Java/Kotlin, then I can do it.I agree. It’s a great idea 😄
Thank you very much.