Throw at build for resolvers that can't be called on their JDK dynamic proxy in 15.0.0
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- graphql, kotlin, spring
- Ambito
- backend-api-design, release, testing
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Kotlin
- Stelle
- 824
- Fork
- 175
- Merge medio
- 2g 5h
- PR unite (30g)
- 52
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di graphql-java-kickstart/graphql-java-tools
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
graphql-java-kickstart/graphql-java-tools#896 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
I maintainer di solito rispondono entro 1 giorno
-
Reject directives applied at the wrong location, without a required argument or twice in 15.0.0Apertaenhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di graphql-java-kickstart/graphql-java-tools
Issue simili
-
area:data-quality importer size:S
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
enorm-labs/event-junkie#3707 ·
I maintainer di solito rispondono entro 1 giorno
-
area/ui priority/p2 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 94/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
commons-app/apps-android-commons#7072 ·
I maintainer di solito rispondono entro 1 giorno
-
bug ci good first issue help wanted severity: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dhananjay-nautiyal/music#17 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
T8RIN/ImageToolbox#3255 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno