Closed azmeuk closed 2 months ago
flat_model
has different values depending on the situations:
https://github.com/felix-martel/pydanclick/blob/2468b62ef0ac9ccd93dedec0eb3d612b537b8f4f/pydanclick/model/validation.py#L44
On cases the exception is raised, it has the value of {'bar': None, 'bar.baz': 'baz'}
, on cases the exception is not raised it has the value of {'bar.baz': 'baz', 'bar': None}
.
It seems that the order has an impact here.
Thanks for the bug report, I'll look into it!
Can reproduce. It was caused by the way we treated default value and was solved by #17 Fix is available in version 0.3
I confirm this is solved with 0.3. Thank you!
With pydantic 2.9.0 and python 3.12, I randomly get an exception with the following snippet:
When using the
| None
syntax instead ofOptional
, the snippet never crashes, though I am not sure why:I am not encountering the exception if the type of bar is
str
for instance: