Skip to content
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

Decorator @minValue, @maxValue to support scalar Duration #3318

Open
3 tasks done
abatishchev opened this issue May 10, 2024 · 0 comments
Open
3 tasks done

Decorator @minValue, @maxValue to support scalar Duration #3318

abatishchev opened this issue May 10, 2024 · 0 comments
Labels
compiler:core Issues for @typespec/compiler design:needed A design request has been raised that needs a proposal triaged:core
Milestone

Comments

@abatishchev
Copy link
Contributor

Clear and concise description of the problem

Context: ARM guidance instructs Resource Providers to expose duration in the ISO 8601#Durations, e.g.:

Human readable System.Timespan Duration
1 minute 00:00:01 PT1M
1 hour 15 minutes 30 seconds 01:15:30 PT1H15M30S

Here's my TypeSpec model where I have a property of type scalar duration but which is missing the Seagger-side validation for the min and max values:

@doc("Threshold properties")
model ThresholdProperties {
  @doc("Window duration")
  //@minValue("?")
  //@maxValue("?")
  windowDuration: duration;
}

Proposal: update the existing decorators minValue and maxValue to support more scalars, such as duration, e.g.:

@minValue("PT1M")
@maxValue("PT1H")
windowDuration: duration;

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@markcowl markcowl added the design:needed A design request has been raised that needs a proposal label May 14, 2024
@markcowl markcowl added this to the Backlog milestone May 14, 2024
@markcowl markcowl added compiler:core Issues for @typespec/compiler triaged:core and removed needs-area labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler design:needed A design request has been raised that needs a proposal triaged:core
Projects
None yet
Development

No branches or pull requests

2 participants