-
Notifications
You must be signed in to change notification settings - Fork 9
Add spec for Long custom scalar type
#26
New issue
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
Merged
martinbonnin
merged 8 commits into
graphql:main
from
jakobmerrild:add-spec-for-long-scalar
Dec 18, 2025
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
66fb671
Add spec for `Long` custom scalar type
jakobmerrild 086bfff
Update scalars/contributed/jakobmerrild/long.md
jakobmerrild efeab84
Update scalars/contributed/jakobmerrild/long.md
jakobmerrild e20ed45
Update wording of Long spec
jakobmerrild 28ba686
Update Long spec to not allow strings for input
jakobmerrild b648fa5
Rewrite Long spec in terms of String encoding
jakobmerrild 5ea5538
Update date of spec
jakobmerrild 622cc03
Fix formatting and spelling
jakobmerrild File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| <!-- cspell:ignore <github user name> --> | ||
|
|
||
| # Long — GraphQL Custom Scalar | ||
|
|
||
| Author - jakobmerrild | ||
|
|
||
| Date - 2024-12-16 | ||
|
|
||
| **License and Copyright** | ||
|
|
||
| Copyright © GraphQL contributors. This specification is licensed under | ||
| [OWFa 1.0](https://www.openwebfoundation.org/the-agreements/the-owf-1-0-agreements-granted-claims/owfa-1-0). | ||
|
|
||
| # Overview | ||
|
|
||
| This Scalar represents a 64-bit signed integer (non-fractional) value, ranging from `-2^63` to `2^63-1`. Such values are commonly | ||
| used to represent timestamps as the number of milliseconds since the UNIX epoch (`1970-01-01T00:00:00.000Z`) | ||
| among other use cases. | ||
|
|
||
| # Name | ||
|
|
||
| The scalar should be named `Long` to match commonly used names for the same data structure in a variety of programming languages. | ||
| Alternatively the scalar can be named `Int64` to represent the 64-bit encoding. | ||
|
|
||
| # Result JSON spec | ||
jakobmerrild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| A field of type `Long` should result in a JSON `number` without a fractional or exponential part. A leading `-` should only be | ||
| added if the field represents a negative value. | ||
martinbonnin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| These are valid examples: | ||
|
|
||
| | Output | Explanation | | ||
| | ---------------------- | -------------------------------------------------------------- | | ||
| | `0` | Zero is a valid integer within the range | | ||
| | `-9223372036854775808` | This is the lowest value that can be represented in the range | | ||
| | `9223372036854775807` | This is the largest value that can be represented in the range | | ||
|
|
||
| These are invalid examples: | ||
|
|
||
| | Output | Explanation | | ||
| | ----------------------- | ------------------------------------------------------------------------ | | ||
| | `+1234` | Leading `+` is not allowed | | ||
| | `-10223372036854775808` | Value is lower than `-2^63` | | ||
| | `12223372036854775807` | Value is greater than `2^63-1` | | ||
| | `123.0` | Fractional part is not allowed even if it is zero | | ||
| | `1e6` | Exponential notation is not allowed, even if it represents a valid value | | ||
| | `"12345"` | String representations of a valid value are not allowed | | ||
|
|
||
| # Literal Input spec | ||
|
|
||
| For input both IntValue and StringValue shall be accepted so long as the StringValue is a base-10 representation of a | ||
| valid value within the range. | ||
jakobmerrild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| These are valid examples: | ||
|
|
||
| | Input | Explanation | | ||
| | ---------------------- | ------------------------------------------------------------------------- | | ||
| | `0` | IntValue within range | | ||
| | `-9223372036854775808` | This is the lowest value that can be represented in the range | | ||
| | `9223372036854775807` | This is the largest value that can be represented in the range | | ||
| | `"987654321"` | A StringValue containing a base-10 representation of the value is allowed | | ||
jakobmerrild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| These are invalid examples: | ||
|
|
||
| | Output | Explanation | | ||
| | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------- | | ||
| | `-10223372036854775808` | Value is lower than `-2^63` | | ||
| | `12223372036854775807` | Value is greater than `2^63-1` | | ||
| | `123.0` | FloatValue is not allowed | | ||
| | `"FFFFF"` | A StringValue containing a base-16 representation of a valid value is not allowed | | ||
| | `"6543.000"` | A StringValue containing a base-10 representation with a fractional part is not allowed. Even if the fractional part is zero | | ||
jakobmerrild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Raw Input JSON spec | ||
|
|
||
| For raw input the same rules apply as for Literal inputs. | ||
jakobmerrild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # References | ||
|
|
||
| - [Support of `Long` (64-bit integer) scalar](https://github.com/graphql/graphql-spec/issues/73) | ||
jakobmerrild marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.