JakobGM / patito

A data modelling layer built on top of polars and pydantic
MIT License
323 stars 25 forks source link

fix: optional list of structs #100

Closed dsgibbons closed 2 months ago

dsgibbons commented 3 months ago

Closes #85

Looks like some logic was copied between struct and list-of-structs validation. There were a few issues:

As a test case, I've included the example from #85.

chainyo commented 3 months ago

Closes #85

Looks like some logic was copied between struct and list-of-structs validation. There were a few issues:

  • The optional outer was being removed before is_optional.
  • Inside the is_optional block (which was never run due to the previous issue), the filter was written for structs, not lists. Fortunately, we can use a much simpler filter for an optional list.

As a test case, I've included the example from #85.

Nice, thanks for iterating on this. I'm glad the example was detailed enough to serve as tests 🔥

thomasaarholt commented 2 months ago

Thank you for fixing this! And apologies for the delay, I started parental leave four weeks ago, and it has taken me a while to get things running smoothly on the home-field 😅

dsgibbons commented 2 months ago

Congratulations @thomasaarholt 🧑🏼‍🍼