Closed bbehling closed 4 years ago
Closing because this looks to be included with the 11.0 release
Closing because this looks to be included with the 11.0 release
What's the usage example if Mutation
is declared with TimeSpan
input type?
public class MutationInput {
[GraphQLType(typeof(TimeSpanType)]
public TimeSpan Duration {get;set;}
}
mutation {
addDuration(input: {
duration: "00h15m00s" # Javascript Duration String
}) {
duration
}
}
Type of string
literal 00h30m00s
or int
of 900
are not recognized as TimeSpan
for automatic deserialization.
"errors": [
{
"message": "TimeSpan cannot parse the given literal of type `StringValueNode`."
}
],
@sar it nust be in the Iso8601 format. tt:mm:ss.sss
TimeSpan support is not available in HotChocolate mutations.
In queries, TimeSpan seems to work because no errors are thrown when adding the ScheduleQuery type, and also returns a TimeSpan class with values in the result.
error: HotChocolate.SchemaException: 'Unable to infer or resolve a schema type from the type reference `Input: System.TimeSpan`.'
Major design issue with that is now we need Hot Chocolate decorators in the Models.
Describe the solution you'd like Support for TimeSpan Scalars in mutations.
Describe alternatives you've considered Workaround is to add
[GraphQLType(typeof(AnyType))]
to the TimeSpan properties.