Throw at build for resolvers that can't be called on their JDK dynamic proxy in 15.0.0
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
- 76/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, spring
- Lĩnh vực
- backend-api-design, release, testing
Hướng nghiên cứu
Read SchemaClassScanner#warnIfNotCallableOnResolver and the existing FieldResolverError implementation to see how resolver errors are reported. Update SchemaParserTest's “parser handles spring AOP proxied resolvers by default” test to verify the error, including when the resolver fallback options are enabled. Add the change to the 15.0.0 release notes; done means the warning becomes an error with the same message and the tests pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Since #853, tools warns at build when a resolver is a JDK dynamic proxy (e.g. Spring AOP with proxyTargetClass = false) and a field resolves to a method or public field the proxy can't call. Spring4AopProxyHandler makes the scanner match fields against the target class, but the proxy only implements the target's interfaces, so every query of those fields fails:
class ProxiedQuery : GraphQLQueryResolver {
fun test() = "ok"
}
val resolver = ProxyFactory(ProxiedQuery()).proxy as GraphQLQueryResolver
object of type jdk.proxy2.$Proxy2 is not an instance of ProxiedQuery
For a public field it's Can not get final int field ProxiedQuery.count on jdk.proxy2.$Proxy2. For a field, the message says to add a getter as well, since class-based proxies don't pass field reads to the target either. The build logs this once per field:
Field 'Query.test' resolves to scenarios.ProxiedQuery.test, but the resolver is a jdk.proxy2.$Proxy2, which isn't a scenarios.ProxiedQuery, so every query of the field will fail. This happens with JDK dynamic proxies, which only implement interfaces. Use class-based proxies instead, e.g. proxyTargetClass = true in Spring.
A field that can never work should fail the build. But a schema whose broken field is never queried builds and runs fine today, so throwing has to wait for a major release.
What to change
- replace the warning in
SchemaClassScanner#warnIfNotCallableOnResolverwith aFieldResolverErrorthat keeps the same message - throw it even with
allowUnimplementedResolversormissingResolverDataFetcherset, since the resolver exists but can't be called - turn
SchemaParserTest."parser handles spring AOP proxied resolvers by default", which only builds today, into a test for the error - mention it in the 15.0.0 release notes
- 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ự
-
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
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
navikt/mock-oauth2-server#1129 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Expose `close` on SsrEngineĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
-
unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
thunderbird/thunderbird-android#11778 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
software-mansion/enriched-markdown#1042 ·
Maintainer thường phản hồi trong vòng 2 ngày