-
-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
Issue Description
With generateToString set to true, the toString methods in the generated *ParametrizedInput classes will check for null on non-nullable primitive types (in my case int). This will make the compilation fail.
Steps to Reproduce
Generate code for a schema containing a not-nullable primitive parameter in a subfield, e.g.
type Query {
clients: [Client!]!
}
type Client {
data(ID: Int!): Data!
}The *ParametrizedInput class for the ID parameter will have a faulty toString method.
Expected Result
The generated toString method does not contain null checks for non-nullable fields, which is the case for classes generated from "normal" types.
Actual Result
The generated toString method contains a null check for an int field, which fails the compilation.
Your Environment and Setup
- graphql-java-codegen: 4.0.0
- Build tool: Maven
- Java tool: AdoptOpenJDK 11.0.8+10
- Mapping Config:
<configuration>
<graphqlSchemaPaths>
${project.basedir}/src/main/resources/.../schema.graphqls
</graphqlSchemaPaths>
<outputDir>
${project.build.directory}/generated-sources/graphql/...
</outputDir>
<apiPackageName>...</apiPackageName>
<modelPackageName>...</modelPackageName>
<packageName>...</packageName>
<generateBuilder>true</generateBuilder>
<generateApis>false</generateApis>
<generateClient>true</generateClient>
<generateToString>true</generateToString>
<customTypesMapping>
<DateTime>java.time.OffsetDateTime</DateTime>
<Date>java.time.LocalDate</Date>
<JSON>java.lang.String</JSON>
<YearMonth>java.time.YearMonth</YearMonth>
</customTypesMapping>
<generateParameterizedFieldsResolvers>false</generateParameterizedFieldsResolvers>
<modelValidationAnnotation>
org.jetbrains.annotations.NotNull
</modelValidationAnnotation>
</configuration>Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working