toReadOnlySchema() fails on schemas with interfaces, unions or custom directives
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- graphql, kotlin
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start by comparing SchemaObjects#toReadOnlySchema() with toSchema(), which the issue identifies as passing the code registry and directives. Check for existing tests around parseSchemaObjects() and add coverage for interfaces, unions, and applied custom directives. Done means toReadOnlySchema() builds those schemas successfully without mutation or subscription support.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
SchemaObjects#toReadOnlySchema() throws for any schema with an interface, a union or an applied custom directive. Same on graphql-java 26.1 and 25.1:
| Schema | parseSchemaObjects().toReadOnlySchema() |
|---|---|
scalar fields only, or @deprecated |
builds |
interface Animal |
AssertException: There must be a type resolver for interface Animal |
union Pet = Dog |
AssertException: There must be a type resolver for union Pet |
name: String @tag with directive @tag on FIELD_DEFINITION |
InvalidSchemaException: invalid schema: A definition for directive 'tag' could not be found |
It only passes the query type and the dictionary to GraphQLSchema.newSchema(), and toSchema() got the extra parts it needed over time but toReadOnlySchema() never did:
- Since 5.6.1 (e6f6f4d, the move to graphql-java 13) the type resolvers live in the code registry instead of on the interface and union types.
toSchema()started passingcodeRegistryBuilder.build(),toReadOnlySchema()doesn't pass a code registry at all. - graphql-java 18.0 started rejecting applied directives without a definition in the schema (graphql-java/graphql-java#2576). 71b9752 added
additionalDirectives(directives)totoSchema()for that in 12.1.0, but not totoReadOnlySchema().
So it's been broken for interfaces and unions since 2019, and for custom directives since 12.1.0. I couldn't find a caller in this org, there's no test for it and nobody reported it, so probably nobody uses it.
Fix would be to pass the same code registry, directives and schema applied directives as toSchema(), just without mutation and subscription. Or deprecate it.
- Ngôn ngữ chính
- Kotlin
- Star
- 824
- Fork
- 175
- Merge trung bình
- 2 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 52
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-java-kickstart/graphql-java-tools
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Reject directives applied at the wrong location, without a required argument or twice in 15.0.0Đang mởenhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
graphql-java-kickstart/graphql-java-tools#881 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của graphql-java-kickstart/graphql-java-tools
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
beppe2880/opencode-mobile#60 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
auth0/Auth0.Android#1101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
LiquidGlass / LiquidGlassContainer (iOS): padded content measured at the outer width and overflows by the paddingCó thể đã có người làm @aleclarson đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NativeScript/NativeScript#11561 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Imported configuration's @Bean methods record the configuration class instead of the return typeĐang mởin:spring-core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
explyt/spring-plugin#787 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
IacobIonut01/ReFra#1335 ·
Maintainer thường phản hồi trong vòng 4 ngày