palantir / conjure-python-client

Python client and JSON encoders for use with generated Conjure clients
Apache License 2.0
7 stars 20 forks source link

Deserializer does not throw exceptions if fields are missing #97

Open deewar opened 4 years ago

deewar commented 4 years ago

Hey,

https://github.com/palantir/conjure-python-client/blob/develop/conjure_python_client/_serde/decoder.py#L50

if the field is missing from the object in the line above instead of throwing exceptions, we call check_null_field which in turn just creates an {} for the field instead of throwing an error.

I could not figure out how optional fields are meant to work here so did not PR but to me it sounds like if it anything but an optional we should throw an exception.

Will PR a fix that i think will work but not sure.

deewar commented 4 years ago

https://palantir.github.io/conjure/#/docs/spec/wire?id=_561-coercing-json-null-absent-to-conjure-types appears to be the answer but this has a terrible ux especially when a small typo can have a wildly different response to what I was expecting https://palantir.github.io/conjure/#/docs/spec/wire?id=_561-coercing-json-null-absent-to-conjure-types