Skip to content

Commit 0fbf191

Browse files
committed
Consider integer as float
1 parent 505258a commit 0fbf191

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/resolvers/NegativeFloat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default new GraphQLScalarType({
1818
},
1919

2020
parseLiteral(ast) {
21-
if (ast.kind !== Kind.FLOAT) {
21+
if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT) {
2222
throw new GraphQLError(
2323
`Can only validate floating point numbers as negative floating point numbers but got a: ${
2424
ast.kind

src/resolvers/NonNegativeFloat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function (name = 'NonNegativeFloat') {
1919
},
2020

2121
parseLiteral(ast) {
22-
if (ast.kind !== Kind.FLOAT) {
22+
if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT) {
2323
throw new GraphQLError(
2424
`Can only validate floating point numbers as non-negative floating point numbers but got a: ${
2525
ast.kind

src/resolvers/NonPositiveFloat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default new GraphQLScalarType({
1818
},
1919

2020
parseLiteral(ast) {
21-
if (ast.kind !== Kind.FLOAT) {
21+
if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT) {
2222
throw new GraphQLError(
2323
`Can only validate floating point numbers as non-positive floating point numbers but got a: ${
2424
ast.kind

src/resolvers/PositiveFloat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default new GraphQLScalarType({
1818
},
1919

2020
parseLiteral(ast) {
21-
if (ast.kind !== Kind.FLOAT) {
21+
if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT) {
2222
throw new GraphQLError(
2323
`Can only validate floating point numbers as positive floating point numbers but got a: ${
2424
ast.kind

0 commit comments

Comments
 (0)