strawberry
strawberry copied to clipboard
Unpack list type when looking up namespaces
Description
The namespace resolver does not check for lists, meaning a type definition of List[Annotated[MyType, strawberry.lazy("my.module")]]
throws strawberry.exceptions.unresolved_field_type.UnresolvedFieldTypeError
Types of Changes
- [ ] Core
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement/optimization
- [ ] Documentation
Issues Fixed or Closed by This PR
- https://github.com/strawberry-graphql/strawberry/issues/2896
Checklist
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [ ] I have added tests to cover my changes.
- Fixes
test_lazy_forward_reference_schema_with_a_list_only
introduced in https://github.com/strawberry-graphql/strawberry/pull/2895
- Fixes
- [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).
Thanks for adding the RELEASE.md
file!
Here's a preview of the changelog:
Fixes an issue where lazy annotations raised an error when used together with a List
Here's the tweet text:
🆕 Release (next) is out! Thanks to jeich for the PR 👏
Get it here 👉 https://strawberry.rocks/release/(next)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.26%. Comparing base (
1bf5425
) to head (6d57b56
).
Additional details and impacted files
@@ Coverage Diff @@
## main #3388 +/- ##
==========================================
- Coverage 96.52% 96.26% -0.26%
==========================================
Files 518 520 +2
Lines 33214 33243 +29
Branches 5522 5526 +4
==========================================
- Hits 32061 32003 -58
- Misses 920 990 +70
- Partials 233 250 +17
CodSpeed Performance Report
Merging #3388 will not alter performance
Comparing jeich:fix-list-annotation
(6d57b56) with main
(1bf5425)
Summary
✅ 12
untouched benchmarks
Nice! Can you add a test? 😊
There are some good tests on this PR for this scenario, should I add the commits to this PR?
@jeich yes please 😊
Added tests from @ddoroshev
Thanks for contributing to Strawberry! 🎉 You've been invited to join the Strawberry GraphQL organisation 😊
You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67
And don't forget to join our discord server: https://strawberry.rocks/discord 🔥