Throw at build for resolvers that can't be called on their JDK dynamic proxy in 15.0.0
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 76/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- graphql, kotlin, spring
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- Kotlin
- 星號
- 824
- 分支
- 175
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 52
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
graphql-java-kickstart/graphql-java-tools 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
維護者通常 1 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 74/100
graphql-java-kickstart/graphql-java-tools#896 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
維護者通常 1 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
維護者通常 1 天內回覆
-
enhancement
難度 3/5 1-2 天 新手友好度 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
維護者通常 1 天內回覆
查看 graphql-java-kickstart/graphql-java-tools 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
commons-app/apps-android-commons#7072 ·
維護者通常 1 天內回覆
-
bug ci good first issue help wanted severity: medium
難度 2/5 1-3 小時 新手友好度 65/100
dhananjay-nautiyal/music#17 · 1 則留言 ·
維護者通常 1 天內回覆
-
Watch Next: last engagement time is in seconds for played items and in milliseconds for the others未關閉
難度 1/5 1 小時以內 新手友好度 79/100
damontecres/Wholphin#2112 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 70/100
beppe2880/opencode-mobile#60 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 72/100