Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As per danoc/gatsby-source-strava-activities#1 I was having isssues with graphql when the results were mixed int and float.
You can use strava-activities and have some activities that have a max speed of a whole number.
I also tracked it down and was able to make a test case
diff --git a/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js b/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js index 95d9f2b0..e0300c7b 100644 --- a/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js +++ b/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js @@ -229,6 +229,16 @@ describe(`GraphQL Input args`, () => { ) }) + it(`Handles a mix of float and int`, async () => { + let fields = inferInputObjectStructureFromNodes({ + nodes: [ + { speed: 1 }, + { speed: 2.1 }, + ], + }).inferredFields + expect(fields.speed.type.toString()).toContain(`Float`) + }) + it(`Replaces unsupported values in keys`, () => { // Add a key with unsupported values to test // if they're replaced.
Graphql figures out the node field should be a float
If the first result is an int, gatsby infers that its an int, not a float
npm list gatsby
gatsby --version
$ lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.5.1804 (Core) Release: 7.5.1804 Codename: Core
Not applicable so not filling out, but i can gatsby-config.js: N/A package.json: N/A gatsby-node.js: N/A gatsby-browser.js: N/A gatsby-ssr.js: N/A
gatsby-config.js
package.json
gatsby-node.js
gatsby-browser.js
gatsby-ssr.js
The text was updated successfully, but these errors were encountered:
i also have the same problem
Sorry, something went wrong.
I'm also suffering from this particular problem. More discussion of the wider issue: #3344
PR with fix if anyone would like to track it - #5654
Successfully merging a pull request may close this issue.
Description
As per danoc/gatsby-source-strava-activities#1 I was having isssues with graphql when the results were mixed int and float.
Steps to reproduce
You can use strava-activities and have some activities that have a max speed of a whole number.
I also tracked it down and was able to make a test case
Expected result
Graphql figures out the node field should be a float
Actual result
If the first result is an int, gatsby infers that its an int, not a float
Environment
npm list gatsby
):gatsby@1.9.260
gatsby --version
):1.9.260
v8.11.2
File contents (if changed)
Not applicable so not filling out, but i can
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/AThe text was updated successfully, but these errors were encountered: