Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Inline references if possible when generating schema forjson_schema_input_type
#10439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
codspeed-hqbot commentedSep 18, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#10439 willdegrade performances by 12.42%Comparing Summary
Benchmarks breakdown
|
github-actionsbot commentedSep 18, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Coverage reportClick to see where and how coverage changed
This report was generated bypython-coverage-comment-action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great work. Thanks for the nice tests here!
Uh oh!
There was an error while loading.Please reload this page.
cloudflare-workers-and-pagesbot commentedSep 18, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Deploying pydantic-docs with |
Latest commit: | 8f3c4b6 |
Status: | ✅ Deploy successful! |
Preview URL: | https://c2e1881d.pydantic-docs.pages.dev |
Branch Preview URL: | https://10434.pydantic-docs.pages.dev |
3a821f1
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Fixes#10434.
Requires#10444.
Previously, the core schema for:
With
pydantic_js_input_core_schema
holding a reference to__main__.Sub:97821927158416
that would not be present in the core schema (because for a plain validator, the source type is not relevant), JSON Schema generation naturally fails (and thankfully only for JSON Schema generation, as thispydantic_js_input_core_schema
metadata field is only relevant for JSON Schemas).My first idea was to add extra logic in the
_WalkCoreSchema
class to handle this metadata field and include it in schema walking, but this is truly not ideal as we are leaking JSON Schema related logic inside this class (kind of a consequence of our metadata handling which wasn't ideal in the first place, as discussed already :/).So I decided we should inline refs in the validator class directly, in a safe way for recursive references.
Checklist