Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Use the globals of the function when evaluating the return type of serializers and computed_fields#10929
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
…rializers and computed_fields
Deploying pydantic-docs with |
Latest commit: | 821184f |
Status: | ✅ Deploy successful! |
Preview URL: | https://2cc7b3e8.pydantic-docs.pages.dev |
Branch Preview URL: | https://func-rt.pydantic-docs.pages.dev |
@pytest.mark.xfail( | ||
reason='In `GenerateSchema`, only the current class module is taken into account. ' | ||
'This is similar to `test_uses_the_correct_globals_to_resolve_model_forward_refs`.' | ||
) |
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.
Turns out this used to work. However, the mentionedtest_uses_the_correct_globals_to_resolve_model_forward_refs
test was also failing on 2.9
@create_module | ||
def module_1(): | ||
from pydantic import BaseModel, field_serializer # or model_serializer | ||
from pydantic import BaseModel, field_serializer # or model_serializer, computed_field |
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.
frompydanticimportBaseModel,field_serializer# or model_serializer, computed_field | |
frompydanticimportBaseModel,field_serializer# or model_serializer |
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.
The goal was to mentioned that this also applied tocomputed_field
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.
Right, but it's not included in the example?
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.
It is commented out, just to mention that the same logic applies to the three decorators. We could add a test for each alternatively.
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.
oh my goodness 😢 sorry I missed that 🫨. Thanks! Let's merge :)
Looking good, I'm guessing there are changes to |
CodSpeed Performance ReportMerging#10929 willnot alter performanceComparing Summary
|
Coverage reportClick to see where and how coverage changed
This report was generated bypython-coverage-comment-action |
Not passing any globals will let |
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.
Nice work, good find. Thanks for the speedy fix.
22a9af2
intomainUh oh!
There was an error while loading.Please reload this page.
…serializers and computed_fields (#10929)
Fixes#10919
Change Summary
Related issue number
Checklist