We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Passing a negative duration TimeSpan from a StrawberryShake client to HotChocolate results in an incorrect deserialized value.
TimeSpan
For example, passing the ISO8601 string "-P1D" results in a deserialized value of -1.00:00:02.1474836 and not -1:00:00:00.
Both StrawberryShake and HotChocolate share the almost identical Iso8601Duration code for serialization:
Iso8601Duration
Unconfirmed fix is to add the following line:
nanoseconds &= ~NegativeBit;
after the line:
var isNegative = (nanoseconds & NegativeBit) != 0;
in the TryToTimeSpan method in both classes.
TryToTimeSpan
Iso8601Duration.TryParse("-P1D", out var ts)
ts
TimeSpan.FromDays(-1)
No response
Hot Chocolate
12.9.0
The text was updated successfully, but these errors were encountered:
@celerum-deryck thanks for reporting :) Do you want to make a pull request?
Sorry, something went wrong.
Fixed deserialization of negative TimeSpans. (#5075) (#5076)
5c712c4
Successfully merging a pull request may close this issue.
Is there an existing issue for this?
Describe the bug
Passing a negative duration
TimeSpan
from a StrawberryShake client to HotChocolate results in an incorrect deserialized value.For example, passing the ISO8601 string "-P1D" results in a deserialized value of -1.00:00:02.1474836 and not -1:00:00:00.
Both StrawberryShake and HotChocolate share the almost identical
Iso8601Duration
code for serialization:Unconfirmed fix is to add the following line:
after the line:
in the
TryToTimeSpan
method in both classes.Steps to reproduce
Iso8601Duration.TryParse("-P1D", out var ts)
and comparets
withTimeSpan.FromDays(-1)
.Relevant log output
No response
Additional Context?
No response
Product
Hot Chocolate
Version
12.9.0
The text was updated successfully, but these errors were encountered: