Error generating classes from generateClientApi or generateClientApiV2
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
Línea de trabajo
Empieza ejecutando mvn clean install con el esquema proporcionado y pom.xml; después, inspecciona los constructores de ShowsProjectionRoot.java y ShowsGraphQLQuery.java comparándolos con sus clases base de DGS. Se considera terminado cuando las clases cliente generadas compilan correctamente con generateClientApiV2 habilitado y se resuelven los errores de constructor informados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Error generating classes from generateClientApi or generateClientApiV2.
Constructors with invalid number of arguments.
schemas:
type Query {
shows: [Show]
}
type Show {
title: String,
id: String
}
I'm using graphqlcodegen-maven-plugin to generate the code. When I run mvn clean install the command generates the classes but with an error:
file: ShowsProjectionRoot.java
package com.graphql.engine.codegen.client;
import com.netflix.graphql.dgs.client.codegen.BaseSubProjectionNode;
import javax.annotation.processing.Generated;
@Generated(
value = "com.netflix.graphql.dgs.codegen.CodeGen",
date = "2024-05-21T18:53:11.998886400Z"
)
@com.graphql.engine.codegen.Generated
public class ShowsProjectionRoot<PARENT extends BaseSubProjectionNode<?, ?>, ROOT extends BaseSubProjectionNode<?, ?>> extends BaseSubProjectionNode<PARENT, ROOT> {
public ShowsProjectionRoot() {
super(null, null, java.util.Optional.of("Show")); //current line with the error because the constructor only accepts two argument
}
public ShowsProjectionRoot<PARENT, ROOT> title() {
getFields().put("title", null);
return this;
}
public ShowsProjectionRoot<PARENT, ROOT> ano() {
getFields().put("ano", null);
return this;
}
}
this is error:
constructor BaseSubProjectionNode in class com.netflix.graphql.dgs.client.codegen.BaseSubProjectionNode<T,R> cannot be applied to given types;
other file ShowsGraphQLQuery with error:
package com.graphql.engine.codegen.client;
import com.netflix.graphql.dgs.client.codegen.GraphQLQuery;
import java.lang.Override;
import java.lang.String;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.processing.Generated;
@Generated(
value = "com.netflix.graphql.dgs.codegen.CodeGen",
date = "2024-05-21T18:53:11.998886400Z"
)
@com.graphql.engine.codegen.Generated
public class ShowsGraphQLQuery extends GraphQLQuery {
public ShowsGraphQLQuery(String queryName) {
super("query", queryName); // current line with the error because the constructor only accepts one argument
}
public ShowsGraphQLQuery() {
super("query");
}
@Override
public String getOperationName() {
return "shows";
}
public static Builder newRequest() {
return new Builder();
}
@Generated(
value = "com.netflix.graphql.dgs.codegen.CodeGen",
date = "2024-05-21T18:53:11.998886400Z"
)
@com.graphql.engine.codegen.Generated
public static class Builder {
private Set<String> fieldsSet = new HashSet<>();
private String queryName;
public ShowsGraphQLQuery build() {
return new ShowsGraphQLQuery(queryName);
}
public Builder queryName(String queryName) {
this.queryName = queryName;
return this;
}
}
}
ERROR: no suitable constructor found for GraphQLQuery(java.lang.String,java.lang.String)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.graphql</groupId>
<artifactId>engine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>engine</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-graphql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.graphql</groupId>
<artifactId>spring-graphql-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<!-- DGS dependencies. We don't have to specify a version here! -->
<dependency>
<groupId>com.netflix.graphql.dgs</groupId>
<artifactId>graphql-dgs-spring-boot-starter</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.netflix.graphql.dgs</groupId>
<artifactId>graphql-dgs-platform-dependencies</artifactId>
<!-- The DGS BOM/platform dependency. This is the only place you set version of DGS -->
<version>3.10.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>io.github.deweyjose</groupId>
<artifactId>graphqlcodegen-maven-plugin</artifactId>
<version>1.50</version>
<executions>
<execution>
<id>dgs-codegen</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaPaths>
<param>src/main/resources/graphql-client</param>
</schemaPaths>
<packageName>com.graphql.engine.codegen</packageName>
<addGeneratedAnnotation>true</addGeneratedAnnotation>
<generateBoxedTypes>true</generateBoxedTypes>
<generateDataTypes>true</generateDataTypes>
<generateClientApiV2>true</generateClientApiV2>
<writeToFiles>true</writeToFiles>
<generateDocs>true</generateDocs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-dgs-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
- Lenguaje dominante
- Kotlin
- Estrellas
- 220
- Forks
- 123
- Merge medio
- 1 d 6 h
- PR fusionados (30 d)
- 23
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Netflix/dgs-codegen
-
Integer default values on `Float` input fields generate code that does not compile (Java and Kotlin)Posiblemente ocupada @0z5a la tomó hace 9 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Netflix/dgs-codegen#1015 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
Netflix/dgs-codegen#1002 ·
Los mantenedores suelen responder en 1 día
-
Object literal default value on a custom scalar fails with NoSuchElementExceptionPosiblemente ocupada @nboisnea la tomó hace 49 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Netflix/dgs-codegen#982 ·
Los mantenedores suelen responder en 1 día
-
HV000271: Using @Valid on a container (java.util.List) is deprecated. You should apply the annotation on the type argument(s).Posiblemente ocupada @jiholee17 la tomó hace 72 días. Abiertoenhancement
Netflix/dgs-codegen#954 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Support Immutable java Data TypesQuizá libre de nuevo @jiholee17 la tomó hace 184 días y no hay ningún pull request abierto. Abiertoenhancement
Netflix/dgs-codegen#944 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Netflix/dgs-codegen
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
DojoCodingLabs/hermit#23 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
signalapp/Signal-Android#15148 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
PranshulGG/WeatherMaster#1266 · 3 comentarios ·
Los mantenedores suelen responder en 1 día