graphql-python / graphql-python/graphene
In 3.1.0, `resolve_type` method on Interfaces and Unions no longer supports returning the GraphQL Type as a string
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 818
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
* **What is the current behavior?**
As of 3.1.0, the `resolve_type` method on Interfaces and Unions no longer supports returning the GraphQL Type as a string as opposed to the actual Graphene Type. I think this might be an unintended regression from https://github.com/graphql-python/graphene/pull/1421.
* **What is the expected behavior?**
Our project heavily depends on resolve_type returning a string for the GraphQL Type as opposed to the Graphene Type that implements it.
* **What is the motivation / use case for changing the behavior?**
While it's possible to refactor most of our code to return the Graphene Type, there are some cases where it's very difficult to break circular imports. The reason for that is that some of our implementations of the `resolve_type` method delegates to returning a property of an Enum and the Enum definition can't reference the Graphene Type because the Graphene Type references the enum.
* **Please tell us about your environment:**
- Version: Trying to upgrade to 3.1.0.
- Platform: Python 3.12.2 on Linux
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)
I created https://github.com/perlow/graphene/pull/1 in a fork. I don't have write permission the repo to request a merge. If this looks reasonable, I can add a unit test for the behavior.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách xem xét cách xử lý resolve_type đã được thay đổi trong hồi quy 3.1.0 được mô tả tại đây và so sánh với thay đổi được đề xuất trong pull request của fork được liên kết. Thêm một unit test bao quát kết quả kiểu GraphQL dạng string, sau đó chạy bộ test liên quan và xác nhận rằng hành vi này hoạt động mà không làm hỏng các kết quả Graphene Type.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100