Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

fix(graphql-server): integer coercion in variables #239

Merged
merged 3 commits into from
Sep 11, 2023

Conversation

gligneul
Copy link
Contributor

Without this patch, the integer variables are always interpreted as BigInts.

Fixes cartesi/rollups-node#81

@gligneul gligneul requested review from tuler and a team September 10, 2023 14:33
@gligneul gligneul self-assigned this Sep 10, 2023
@gligneul gligneul changed the title fix(graphql-server): input coercion when reading variables fix(graphql-server): integer coercion in variables Sep 10, 2023
@tuler
Copy link
Member

tuler commented Sep 11, 2023

Is it necessary to check the value to decide how to parse?

@gligneul
Copy link
Contributor Author

Is it necessary to check the value to decide how to parse?

The other options are:

  • Always converting to int32 integers since we don't have int64 variables.
  • Don't convert and change the variables to int64. I don't like this option because it will change the schema.

@tuler
Copy link
Member

tuler commented Sep 11, 2023

Don't you know the type of the variable from its definition?

@gligneul
Copy link
Contributor Author

gligneul commented Sep 11, 2023

@tuler, when deserializing from a JSON, the library doesn't know the type of the value it expects. It reads all integer values as int64, so it needs to change the type given the value. More info: https://docs.rs/juniper/latest/juniper/trait.ScalarValue.html

@gligneul gligneul merged commit 6897b67 into release/1.0.x Sep 11, 2023
16 checks passed
@gligneul gligneul deleted the fix/graphql-inputs branch September 11, 2023 21:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants