Skip to content

Commit 0abcc47

Browse files
Thomas Amlandbbakerman
authored andcommitted
support uuid as id type
1 parent 943d56e commit 0abcc47

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/graphql/Scalars.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import java.math.BigDecimal;
1515
import java.math.BigInteger;
16+
import java.util.UUID;
1617

1718
import static graphql.Assert.assertShouldNeverHappen;
1819

@@ -274,6 +275,9 @@ private String convertImpl(Object input) {
274275
if (input instanceof Long) {
275276
return String.valueOf(input);
276277
}
278+
if (input instanceof UUID) {
279+
return String.valueOf(input);
280+
}
277281
return null;
278282

279283
}

src/test/groovy/graphql/ScalarsIDTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class ScalarsIDTest extends Specification {
4646
"123ab" | "123ab"
4747
123 | "123"
4848
123123123123123123L | "123123123123123123"
49+
UUID.fromString("037ebc7a-f9b8-4d76-89f6-31b34a40e10b") | "037ebc7a-f9b8-4d76-89f6-31b34a40e10b"
4950
}
5051

5152
@Unroll

0 commit comments

Comments
 (0)