strawberry icon indicating copy to clipboard operation
strawberry copied to clipboard

Unpack list type when looking up namespaces

Open jeich opened this issue 6 months ago • 6 comments

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
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

jeich avatar Feb 19 '24 19:02 jeich

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)

botberry avatar Feb 19 '24 19:02 botberry

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     

codecov[bot] avatar Feb 19 '24 19:02 codecov[bot]

CodSpeed Performance Report

Merging #3388 will not alter performance

Comparing jeich:fix-list-annotation (6d57b56) with main (1bf5425)

Summary

✅ 12 untouched benchmarks

codspeed-hq[bot] avatar Feb 19 '24 20:02 codspeed-hq[bot]

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 avatar Feb 19 '24 22:02 jeich

@jeich yes please 😊

patrick91 avatar Feb 20 '24 11:02 patrick91

Added tests from @ddoroshev

jeich avatar Feb 20 '24 16:02 jeich

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 🔥

botberry avatar May 25 '24 10:05 botberry