Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Throw when a resolver method is missing a parameter for an argument in 15.0.0

Abierto
#889 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
graphql, kotlin

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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#warnIfParameterMissing with a FieldResolverError that keeps the same message
  • throw it even with allowUnimplementedResolvers or missingResolverDataFetcher set, 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
Lenguaje dominante
Kotlin
Estrellas
824
Forks
175
Merge medio
2 d 5 h
PR fusionados (30 d)
52

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de graphql-java-kickstart/graphql-java-tools

Todos los issues de graphql-java-kickstart/graphql-java-tools

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.