You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@nnbbz
I will soon release a new version (4.1.4) with this fix.
Thanks for reporting this issue!
Meanwhile, you can use a workaround in your config to replace all non-null types (Int) with nullable types (Integer):
mapping.put("Int!", "java.lang.Integer")
kobylynskyi
changed the title
[Auto Generated POJO not working for Integers defined in interface.] (Version: 4.1.0)
Compilation error when field is non-null in type and nullable in interface [Version 4.1.0]
Feb 25, 2021
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
The text was updated successfully, but these errors were encountered: