Skip to content

Coerce built-in scalars and reject invalid values - #956

Open
hugo-vrijswijk wants to merge 1 commit into
mainfrom
coerce-builtins
Open

hugo-vrijswijk wants to merge 1 commit into
mainfrom
coerce-builtins

Conversation

@hugo-vrijswijk

Copy link
Copy Markdown
Contributor

Fixes #955

Attempts to coerce built-in scalar values to the expected type (42 -> "42" for String, etc). Reject values that cannot be coerced (e.g. true for Float) rather than returning an incorrect type.

Coercion is specified in the GraphQL spec: https://spec.graphql.org/September2025/#sec-Scalars.Result-Coercion-and-Serialization. No specific rules are mentioned for what should or shouldn't be coerced, instead it is left to the implementation.

Fixes #955

Attempts to coerce built-in scalar values to the expected type (`42` -> `"42"` for `String`, etc). Reject values that cannot be coerced (e.g. `true` for `Float`) rather than returning an incorrect type.

Coercion is specified in the GraphQL spec: https://spec.graphql.org/September2025/#sec-Scalars.Result-Coercion-and-Serialization. No specific rules are mentioned for what _should_ or _shouldn't_ be coerced, instead it is left to the implementation.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CirceCursor.asLeaf incorrectly validates primitive json values

1 participant