Skip to content

Commit 3c2ffc8

Browse files
committed
id scalar will now use String.valueOf on serialise
1 parent b8be7d1 commit 3c2ffc8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/main/java/graphql/Scalars.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ private String convertImpl(Object input) {
287287

288288
@Override
289289
public String serialize(Object input) {
290-
String result = convertImpl(input);
290+
String result = String.valueOf(input);
291291
if (result == null) {
292292
throw new CoercingSerializeException(
293293
"Expected type 'ID' but was '" + typeName(input) + "'."

src/test/groovy/graphql/ScalarsIDTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class ScalarsIDTest extends Specification {
5151
}
5252

5353
@Unroll
54-
def "serialize throws exception for invalid input #value"() {
54+
def "serialize allows any object via String.valueOf #value"() {
5555
when:
5656
Scalars.GraphQLID.getCoercing().serialize(value)
5757
then:
58-
thrown(CoercingSerializeException)
58+
noExceptionThrown()
5959

6060
where:
6161
value | _

0 commit comments

Comments
 (0)