Skip to content
Snippets Groups Projects
  1. Dec 19, 2024
  2. Nov 25, 2024
  3. Nov 14, 2024
  4. Nov 13, 2024
  5. Nov 08, 2024
  6. Mar 06, 2024
    • Erin (Josh) Rigler's avatar
      Fix custom json encoder in pydantic+fastapi · 3ee389ea
      Erin (Josh) Rigler authored
      Pydantic v1's json module contain[s|ed] a dictionary called `ENCODERS_BY_TYPE`
      that was commonly used to overide default json encoders. Pydantic v2 is moving
      away from this to a "better" system. FastAPI attempted to stay compatible with
      both v1 and v2 by pulling ENCODERS_BY_TYPE into their own codebase, but this
      broke our custom type `UTCDateTime`, at least for anything using fastapi.
      
      We thought we fixed this with a recent MR, but it turns out all we did was
      fix the validator. We did not fix the encoder itself. So, validation steps
      would pass, but we continued to server malformed json for UTCDateTimes. This
      commit reverts to the earlier version of pydantic_utcdatetime.py, and adds a
      small kluge that modifies `ENCODERS_BY_TYPE` in both pydantic and fastapi.
      3ee389ea
  7. Feb 14, 2024
  8. Aug 17, 2021
  9. Apr 06, 2020
Loading