You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
duration defaults to a string on the wire, but Azure prohibits ISO8601 durations outside of recurrences. We should have a linting rule that validates anyone using duration is also specifying @encode(DurationKnownEncoding.seconds) for any of the numeric duration types.
Check that this issue is about the Azure libraries for typespec. For feature request in the typespec language or core libraries file it in the TypeSpec repo
Something that's been bothering me a little bit lately about this is that it seems like the space of values that can exist in a duration changes depending on what the encoding is. If I have a duration of one week (P1W), then I can't actually encode it to an amount of time unless I have a reference instant and a time zone. It's fine as long as your duration value doesn't contain any units of weeks, months, or years, but that we support ISO8601 implies that it can (that also makes it challenging to represent a duration correctly unless you have some type that has the exact semantics of an ISO8601 Duration).
It makes sense that in Azure we would want to use duration for intervals only and numbers for fixed lengths of time, but I have to wonder if it doesn't make more sense to just have the type of the property be an integer and forget about trying to encode through duration if what we're trying to express is always a fixed length of time and not a duration in the strict ISO sense.
Clear and concise description of the problem
duration
defaults to a string on the wire, but Azure prohibits ISO8601 durations outside of recurrences. We should have a linting rule that validates anyone usingduration
is also specifying@encode(DurationKnownEncoding.seconds)
for any of the numeric duration types.Checklist
The text was updated successfully, but these errors were encountered: