Have required and NonNull true by default at the project level
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Trước tiên, hãy lần theo cách các giá trị mặc định required và NonNull hiện được xác định cho các field và truy vấn danh sách, sau đó xác định điểm đầu vào cấu hình cấp dự án được mô tả trong yêu cầu. Làm rõ cách required=false được chỉ định tường minh và các kiểu danh sách nullable hoặc tùy chọn nên ghi đè các giá trị mặc định mới như thế nào, đồng thời bổ sung coverage cho các trường hợp đó trước khi coi tính năng là hoàn tất.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
I'm always frustrated when I have to explicitly set required a List field, or any field for that matter. It makes for really frustrating usage of our APIs that rely on typescript types generated by our graphene schema. We have to constantly add unnecessary checks and write more obtuse code just to satisfy our types. On top of that, the way that this typing is done both in python(pyright and I believe others) and in typescript are the exact opposite, you explicitly define that something can be optional. This makes it extremely unintuitive and hard to spot issues until the api starts getting use from our typescript apps.
Describe the solution you'd like
A setting at the root level to have required default to true always se we have to explicitly set required to false. This would also apply to NonNull for list queries which might need a Nullable, or Optional, or allow the required argument for type to work with the list.
Describe alternatives you've considered
I can build new types that extend the existing types and add a linter to make sure none of the original types are being used in future development. It's doable, and I'll end up doing it, but the solution I'm suggesting doesn't feel that farfetched to put in for others who may have this frustration.
Additional context
In typescript if I want to type as an array I can use Array, or [], and it will be an array, it wont expect null and it wont expect undefined. I have to be explicit if the value is nullable or undefined. Similarly in python, with pyright at least, you also have to be making sure to be explicit that the type is optional or nullable.
I'm at the very least curious why required is defaulted to false in the first place.
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 822
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của graphql-python/graphene
-
Tutorial mistakesĐang mở🐛 bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
graphql-python/graphene#1389 · 5 bình luận · 2 reaction ·
-
Support OneOf input object typesĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
graphql-python/graphene#1606 ·
-
Python 3.14 supportĐang mở✨ enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
graphql-python/graphene#1601 · 2 bình luận ·
-
✨ enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
graphql-python/graphene#1600 ·
-
Inaccurate Float-to-Decimal Conversion in `parse_value` of `Decimal` `Scalar`Có thể đã có người làm @mak626 đã nhận 609 ngày trước. Đang mở🐛 bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 55/100
graphql-python/graphene#1593 ·
Tất cả issue của graphql-python/graphene
Issue tương tự
-
Consolidate the now-identical CLI-native and composed tasks_packages guards (#5945 follow-up)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
spec-kitty/spec-kitty#6112 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: OpenRouter streaming chunks report the requested router name instead of the model OpenRouter servedCó thể đã có người làm @Mrun25 đã nhận hôm nay. Đang mởbug llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
BerriAI/litellm#46095 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
uberdeveloper/fastbt#29 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
andrew-blake/melcloudhome#368 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
lane:discover
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SPARDiffData/differential-data-collection#33 ·
Maintainer thường phản hồi trong vòng 1 ngày