Skip to content

Commit 28a4a97

Browse files
committed
2445 SF
1 parent e2b76bd commit 28a4a97

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

server/libs/platform/platform-mcp/platform-mcp-graphql/src/main/java/com/bytechef/platform/mcp/web/graphql/config/LongScalarConfiguration.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import graphql.schema.CoercingParseValueException;
2424
import graphql.schema.CoercingSerializeException;
2525
import graphql.schema.GraphQLScalarType;
26+
import java.math.BigInteger;
2627
import java.time.Instant;
2728
import org.springframework.context.annotation.Bean;
2829
import org.springframework.context.annotation.Configuration;
@@ -46,17 +47,21 @@ private GraphQLScalarType longScalar() {
4647
.name("Long")
4748
.description("A Long scalar that represents a 64-bit signed integer")
4849
.coercing(new Coercing<Long, Long>() {
50+
4951
@Override
5052
public Long serialize(Object dataFetcherResult) throws CoercingSerializeException {
5153
if (dataFetcherResult instanceof Long) {
5254
return (Long) dataFetcherResult;
5355
}
56+
5457
if (dataFetcherResult instanceof Number) {
5558
return ((Number) dataFetcherResult).longValue();
5659
}
60+
5761
if (dataFetcherResult instanceof Instant) {
5862
return ((Instant) dataFetcherResult).toEpochMilli();
5963
}
64+
6065
if (dataFetcherResult instanceof String) {
6166
try {
6267
return Long.parseLong((String) dataFetcherResult);
@@ -93,8 +98,9 @@ public Long parseValue(Object input) throws CoercingParseValueException {
9398
@Override
9499
public Long parseLiteral(Object input) throws CoercingParseLiteralException {
95100
if (input instanceof IntValue) {
96-
return ((IntValue) input).getValue()
97-
.longValue();
101+
BigInteger bigInteger = ((IntValue) input).getValue();
102+
103+
return bigInteger.longValue();
98104
}
99105

100106
if (input instanceof StringValue) {

server/libs/platform/platform-mcp/platform-mcp-graphql/src/main/java/com/bytechef/platform/mcp/web/graphql/config/MapScalarConfiguration.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/**
3131
* Configuration class for registering the Map scalar type with GraphQL.
3232
*
33-
* @author Junie
33+
* @author Ivica Cardic
3434
*/
3535
@Configuration
3636
class MapScalarConfiguration {
@@ -45,11 +45,13 @@ private GraphQLScalarType mapScalar() {
4545
.name("Map")
4646
.description("A map scalar that represents a JSON object")
4747
.coercing(new Coercing<Map<String, Object>, Map<String, Object>>() {
48+
4849
@Override
4950
public Map<String, Object> serialize(Object dataFetcherResult) throws CoercingSerializeException {
5051
if (dataFetcherResult instanceof Map) {
5152
return (Map<String, Object>) dataFetcherResult;
5253
}
54+
5355
throw new CoercingSerializeException("Expected a Map object");
5456
}
5557

@@ -58,6 +60,7 @@ public Map<String, Object> parseValue(Object input) throws CoercingParseValueExc
5860
if (input instanceof Map) {
5961
return (Map<String, Object>) input;
6062
}
63+
6164
throw new CoercingParseValueException("Expected a Map object");
6265
}
6366

@@ -66,6 +69,7 @@ public Map<String, Object> parseLiteral(Object input) throws CoercingParseLitera
6669
if (input instanceof StringValue) {
6770
return parseValue(((StringValue) input).getValue());
6871
}
72+
6973
throw new CoercingParseLiteralException("Expected a StringValue");
7074
}
7175
})

0 commit comments

Comments
 (0)