Skip to content

Update validation section for ChilliCream Date/Time scalars#67

Draft
glen-84 wants to merge 2 commits intographql:mainfrom
glen-84:gai/date-time-precision
Draft

Update validation section for ChilliCream Date/Time scalars#67
glen-84 wants to merge 2 commits intographql:mainfrom
glen-84:gai/date-time-precision

Conversation

@glen-84
Copy link
Contributor

@glen-84 glen-84 commented Feb 20, 2026

No description provided.

Comment on lines +111 to +114
- Fractional seconds, if present, are numeric (up to 9 digits)
- Fractional seconds, if present, are numeric and do not exceed the precision
supported by the implementation's underlying date-time type. Implementations
must not silently truncate or round fractional seconds beyond their supported
precision; instead, they should reject input that exceeds it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a breaking change. The specifications should be implementation agnostic.

I interpret that sentence as "fractional seconds may have infinite precision" if an implementation supports it.

Which contradicts the counter example: 2023-12-24T15:30:00.1234567890Z might become a valid scalar representation after that change.

More generally, I think a scalar specification must not reference any specific implementation. It should stick to defining the format for all implementations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I interpret that sentence as "fractional seconds may have infinite precision" if an implementation supports it.

The maximum of 9 is specified for results, but you're right that this new text for inputs should also mention this limit. I'll update the text.

More generally, I think a scalar specification must not reference any specific implementation. It should stick to defining the format for all implementations.

Where is it referencing a specific implementation? This rule is for all implementations, intentionally.

If we specify 9 digits, then it might look like the Hot Chocolate implementation is invalid (only supporting 7), but maybe it's enough that the current spec uses "up to 9", and this update is unnecessary?

Copy link
Contributor

@martinbonnin martinbonnin Feb 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant its mentioning "implementations" in general. "implementations" leaves the door open to interpretations.

The specification should only care about describing the format. "Implementations" is a separate concern IMO.

f we specify 9 digits, then it might look like the Hot Chocolate implementation is invalid (only supporting 7)

I'd argue it is invalid then. Unless you explicitely allow loss of precision in input coercion, which sounds a bit dangerous but possible I guess.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you may explicitely throw in input coercion if precision is too high I guess. All in all, I'd keep the "up to 9" and "input coercion: implementations must not lose precision and raise an error if the given value does not exist in their internal representation"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"input coercion: implementations must not lose precision and raise an error if the given value does not exist in their internal representation"

... but this mentions implementations?

Also, did you mean must or must not raise an error? (slightly ambiguous in that sentence)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it's the end of the week... 😅 It looks like you want to "raise an error" if the implementation does not support the value.

My beef is with this sentence:

  • Fractional seconds, if present, are numeric and do not exceed the precision
    supported by the implementation's underlying date-time type.

How many digits is that? No one knows from reading the spec. It's not describing a format, it leaves the format open to interpretation. I would instead go with either:

  1. fixed precision (9 digits for an example)
  2. infinite precision

Then if you really want to, you could add a note that implementations may throw in input coercion. That, at least leaves output coercion untouched.

Doing so kind of limits the value of the specification IMO, since it means some "valid" representations of the scalars won't be usable at runtime for some implementations.

If this is the format used by Hot Chocolate, I would go with fixed precision (7 digits max).

Another question is whether this requires a new url for people who are relying on the previous version of the scalar.

This is all FYI by the way, since you own this spec, feel free to land on what you think is best!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially trying to make the specs as "generic" as possible, and thus specified up to 9 fractional seconds for implementations that may support that. However, given that (a) These are now more ChilliCream-specific specs, and (b) .NET and our implementations only support 7 fractional seconds, it probably makes sense for the specs to also limit the digits to 7.

I've made these changes now, but let's wait until next week before we merge.

We don't need new URLs, since the existing URLs have not been used in a stable release of Hot Chocolate.

Thanks for the review. 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

the existing URLs have not been used in a stable release of Hot Chocolate.

Technically speaking, they're published on the internet so someone outside chillicream might already be relying on 9 digits somewhere in the world.

It's probably fine to not be too dogmatic here though.

@glen-84 glen-84 marked this pull request as draft February 20, 2026 18:11
@glen-84 glen-84 marked this pull request as ready for review March 4, 2026 07:07
@glen-84 glen-84 marked this pull request as draft March 6, 2026 11:01
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.

2 participants