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

Support "x-ms-format": "duration-constant" #1901

Open
Tracked by #1850
pshao25 opened this issue Nov 22, 2024 · 0 comments
Open
Tracked by #1850

Support "x-ms-format": "duration-constant" #1901

pshao25 opened this issue Nov 22, 2024 · 0 comments
Assignees

Comments

@pshao25
Copy link
Member

pshao25 commented Nov 22, 2024

Some swagger will have "x-ms-format": "duration-constant" on their model property for example. We may need a new scalar for it. What's more, TCGC needs to pass this value to emitter.

BTW I have some trial just FYI
1.

model Test {
  @format("duration-constant")
  input: duration;
}

This gives error Cannot apply @format decorator to type it is not a string

model Test {
  @format("duration-constant")
  input: string;
}

This gives warning 'string' format 'duration-constant' is not supported in Autorest. It will not be emitted. The emitted swagger does not emit this either.

More information added: For swagger input, it must be "x-ms-format": "duration-constant" for the generated swagger, otherwise this error:

fatal   | System.InvalidOperationException: The MaximumDuration property of VirtualMachineInstallPatchesParameters ends with "Duration" but does not use the duration format to be generated
   as TimeSpan type. Add "format": "duration" with directive in autorest.md for the property if it's ISO 8601 format like P1DT2H59M59S. Add "x-ms-format": "duration-constant" if it's the con 
  stant format like 1.2:59:59.5000000. If the property does not conform to a TimeSpan format, please use "x-ms-client-name" to rename the property for the client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants