You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a number field with values like2018 Gatsby will think it is a date string and add it in the schema as a GraphQLString instead of GraphQLInt or GraphQLFloat. I think what is causing this problem is this check. It is mainly a problem of order for the checks so if we move that check here
I would like to create a PR to fix this. If there is a better place to fix this please direct me to it and any feedback is appreciated.
If you add this test to infer-graphql-test.js
it(`handles integer with valid date format`, async () => {
let result = await queryResult(
[{ number: 2018 }, { number: 1987 }],
`
number
`
)
expect(result.data.listNode[0].number).toEqual(2018)
})
Gatsby version: Latest
Node.js version: 8.4.x
Operating System: All
Actual result
If you have a number field with values like2018 Gatsby will think it is a date string and add it in the schema as a GraphQLString instead of GraphQLInt or GraphQLFloat
Expected behavior
Integer values are returned as GraphQLInt or GraphQLFloat
Steps to reproduce
I found out about this using gatsby-source-contentful
1. Create a content module with an integer field
2. enter a value that can be a valid date 2018
3. Use GeaphIQl to query the data
4. Observe the issue
The text was updated successfully, but these errors were encountered:
Description
If you have a number field with values like
2018
Gatsby will think it is a date string and add it in the schema as aGraphQLString
instead ofGraphQLInt
orGraphQLFloat
. I think what is causing this problem is this check. It is mainly a problem of order for the checks so if we move that check hereI would like to create a PR to fix this. If there is a better place to fix this please direct me to it and any feedback is appreciated.
If you add this test to
infer-graphql-test.js
you will get this error
cc @KyleAMathews
Environment
Gatsby version: Latest
Node.js version: 8.4.x
Operating System: All
Actual result
If you have a number field with values like
2018
Gatsby will think it is a date string and add it in the schema as aGraphQLString
instead ofGraphQLInt
orGraphQLFloat
Expected behavior
Integer values are returned as
GraphQLInt
orGraphQLFloat
Steps to reproduce
I found out about this using
gatsby-source-contentful
1. Create a content module with an integer field
2. enter a value that can be a valid date
2018
3. Use GeaphIQl to query the data
4. Observe the issue
The text was updated successfully, but these errors were encountered: