Throw when a resolver method is missing a parameter for an argument 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
- 72/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- graphql, kotlin
- Domaine
- backend-api-design
Piste de recherche
Start in SchemaClassScanner#warnIfParameterMissing and read the existing warning path, then inspect MethodFieldResolverTest for the named test and the 15.0.0 release notes. Replace the warning with a FieldResolverError that preserves its message and verify it is thrown even when either resolver fallback option is enabled. Done when the test asserts the error and the release notes describe the change.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Follow-up to #418 and #890. Tools now warns at build when a resolver method is missing the parameter for an argument and has a DataFetchingEnvironment, GraphQLContext or contextClass parameter instead. The parameter count still matches, so the scanner accepts it and maps the arguments by position:
type Query {
users(first: Int): UserConnection
}
fun users(env: DataFetchingEnvironment): Connection<User>
Every query of users then fails, with Parameter specified as non-null is null: ... parameter env when first is omitted and Cannot construct instance of graphql.schema.DataFetchingEnvironment when it's sent. The build logs:
Field 'Query.users' has no parameter for its argument 'first: Int' in scenarios.ContextMisboundQuery.users, so the DataFetchingEnvironment parameter gets the argument instead. Add a parameter for each argument, in order, before the DataFetchingEnvironment parameter.
For the contextClass it only warns when the argument is a spec scalar, since the context class can also be a real argument type (e.g. contextClass(Map) with an input object mapped to a Map).
A resolver like this can't work, so it 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#warnIfParameterMissingwith aFieldResolverErrorthat keeps the same message - throw it even with
allowUnimplementedResolversormissingResolverDataFetcherset, since the resolver exists but can't be called - turn
MethodFieldResolverTest."should warn when a resolver method is missing a parameter for an argument"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 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
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
graphql-java-kickstart/graphql-java-tools#881 ·
Les mainteneurs répondent en général sous 1 jour
-
Directive wirings see a type reference on recursive input fieldsPeut-être pris @oryan-block l’a pris il y a 1 jour. Ouvertebug
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
graphql-java-kickstart/graphql-java-tools#875 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de graphql-java-kickstart/graphql-java-tools
Issues similaires
-
area/kotlin
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
dafonton77-tech/Cadreenf#11 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
Hy4ri/hermes-mobile#1647 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
supabase-community/supabase-kt#1429 ·
Les mainteneurs répondent en général sous 5 jours