Skip to content

Commit 57779ec

Browse files
meistermeierkobylynskyi
authored andcommitted
Move null condition to top.
1 parent 6acc136 commit 57779ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/kobylynskyi/graphql/codegen/mapper/ValueMapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ public String map(MappingContext mappingContext, Value<?> value, Type<?> graphQL
121121
}
122122

123123
private String mapEnum(MappingContext mappingContext, EnumValue value, Type<?> graphQLType) {
124+
if (graphQLType == null) {
125+
return value.getName();
126+
}
124127
if (graphQLType instanceof TypeName) {
125128
String typeName = ((TypeName) graphQLType).getName();
126129
typeName = DataModelMapper.getModelClassNameWithPrefixAndSuffix(mappingContext, typeName);
@@ -129,9 +132,6 @@ private String mapEnum(MappingContext mappingContext, EnumValue value, Type<?> g
129132
if (graphQLType instanceof NonNullType) {
130133
return mapEnum(mappingContext, value, ((NonNullType) graphQLType).getType());
131134
}
132-
if (graphQLType == null) {
133-
return value.getName();
134-
}
135135
throw new IllegalArgumentException("Unexpected Enum value for list type");
136136
}
137137

0 commit comments

Comments
 (0)