Throw at build for resolvers that can't be called on their JDK dynamic proxy in 15.0.0
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 76/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- graphql, kotlin, spring
- Domaine
- backend-api-design, release, testing
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Kotlin
- Étoiles
- 824
- Forks
- 175
- Merge moyen
- 2 j 5 h
- PR mergées (30 j)
- 52
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de graphql-java-kickstart/graphql-java-tools
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
graphql-java-kickstart/graphql-java-tools#893 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 74/100
graphql-java-kickstart/graphql-java-tools#896 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
graphql-java-kickstart/graphql-java-tools#889 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
graphql-java-kickstart/graphql-java-tools#886 ·
Les mainteneurs répondent en général sous 1 jour
-
Reject directives applied at the wrong location, without a required argument or twice in 15.0.0Ouverteenhancement
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
graphql-java-kickstart/graphql-java-tools#884 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de graphql-java-kickstart/graphql-java-tools
Issues similaires
-
enhancement impact:U1 P3 reach:R2 size:S
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
enhancement triaged
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
ankidroid/Anki-Android#22677 ·
Les mainteneurs répondent en général sous 1 jour
-
Type Pick Request
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
reactwg/react-native-releases#1456 · 1 commentaire ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
yschimke/homeassistant-remotecompose#1038 ·
Les mainteneurs répondent en général sous 1 jour