Skip to content

Compilation error when field is non-null in type and nullable in interface [Version 4.1.0] #556

Closed
@nnbbz

Description

@nnbbz

Issue Description

If you have an interface that defines an Int (optional)
and you have a type that implements the interface but turns it to Required (Int!)

the resultant class that gets generated uses the primitive type int instead of the Object Integer. All other int is Integer. This seems like a bug?

The workaround currently is to add this in the customTypesMapping

mapping.put("Int!", "java.lang.Integer") <-- notice that you HAVE to specify Int! with the exclamation mark. This could be another bug?

Steps to Reproduce

Have your graphqls schema as follows:

type First implements Second {
test: Int!
}

interface Second {
test: Int
}

Run code generator with Java.

Expected Result

First.java should be Integer test.

Actual Result

Explain in detail what behavior actually happened.
First.java is primitive type int.

Environment and Setup

  • graphql-java-codegen: 4.1.0
  • Build tool: E.g.: SBT

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions