Skip to content

Fixing Pydantic Extension#1021

Merged
tfranzel merged 2 commits intotfranzel:masterfrom
sydney-runkle:patch-1
Jul 9, 2023
Merged

Fixing Pydantic Extension#1021
tfranzel merged 2 commits intotfranzel:masterfrom
sydney-runkle:patch-1

Conversation

@sydney-runkle
Copy link
Copy Markdown
Contributor

Hey tfranzel,

Thanks for your help with adding support for pydantic a few weeks ago.

It came to my attention earlier today while running some tests that the __schema_cache__ from pydantic was causing problems when any of the pages associated with the schema views were refreshed. The model_schema function from pydantic doesn't use a cache, whereas the model.schema() does utilize this cache. Additionally, the ref_prefix param of the model_schema function allows for the removal of some of the other functionality we hard coded.

I came up with the above solution based on the pydantic documentation as well as this previously opened issue.

Let me know what you think!

Copy link
Copy Markdown
Owner

@tfranzel tfranzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent point @sydney-runkle. it is the better implementation.

I totally forgot about #801 and reimplemented the extension. 🤣 I wonder though how he got the extension working without the 3 fixes we applied specifically for this to work.

Comment thread docs/blueprints/pydantic.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 9, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (e0f749e) 98.54% compared to head (f31c7a6) 98.54%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1021   +/-   ##
=======================================
  Coverage   98.54%   98.54%           
=======================================
  Files          68       68           
  Lines        8338     8338           
=======================================
  Hits         8217     8217           
  Misses        121      121           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tfranzel tfranzel merged commit b800dfb into tfranzel:master Jul 9, 2023
@tfranzel
Copy link
Copy Markdown
Owner

tfranzel commented Jul 9, 2023

excellent! thx sydney.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants