Skip to content

Commit 753c2ec

Browse files
committed
Revert stricter parseValue coercion for Boolean
1 parent ca4836b commit 753c2ec

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/main/java/graphql/scalar/GraphqlBooleanCoercing.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ private Boolean serializeImpl(@NotNull Object input, @NotNull Locale locale) {
6868

6969
@NotNull
7070
private Boolean parseValueImpl(@NotNull Object input, @NotNull Locale locale) {
71-
if (!(input instanceof Boolean)) {
71+
Boolean result = convertImpl(input);
72+
if (result == null) {
7273
throw new CoercingParseValueException(
73-
i18nMsg(locale, "Boolean.unexpectedRawValueType", typeName(input))
74+
i18nMsg(locale, "Boolean.notBoolean", typeName(input))
7475
);
7576
}
76-
return (Boolean) input;
77+
return result;
7778
}
7879

7980
private static boolean parseLiteralImpl(@NotNull Object input, @NotNull Locale locale) {

src/main/resources/i18n/Scalars.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ Float.unexpectedRawValueType=Expected a Number input, but it was a ''{0}''
2828
#
2929
Boolean.notBoolean=Expected a value that can be converted to type ''Boolean'' but it was a ''{0}''
3030
Boolean.unexpectedAstType=Expected an AST type of ''BooleanValue'' but it was a ''{0}''
31-
Boolean.unexpectedRawValueType=Expected a Boolean input, but it was a ''{0}''

src/main/resources/i18n/Scalars_de.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ Float.unexpectedRawValueType=Erwartet wurde eine Number-Eingabe, aber es war ein
2828
#
2929
Boolean.notBoolean=Erwartet wurde ein Wert, der in den Typ ''Boolean'' konvertiert werden kann, aber es war ein ''{0}''
3030
Boolean.unexpectedAstType=Erwartet wurde ein AST type ''BooleanValue'', aber es war ein ''{0}''
31-
Boolean.unexpectedRawValueType=Erwartet wurde eine Boolean-Eingabe, aber es war ein ''{0}''

0 commit comments

Comments
 (0)