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

[Feature Request] Support encode string for decimal #2762

Closed
MaryGao opened this issue Dec 19, 2023 · 2 comments
Closed

[Feature Request] Support encode string for decimal #2762

MaryGao opened this issue Dec 19, 2023 · 2 comments
Labels
design:needed A design request has been raised that needs a proposal triaged:core
Milestone

Comments

@MaryGao
Copy link
Member

MaryGao commented Dec 19, 2023

The discussion is from JS decimal support, for decimal type in typespec not every language has the native support or has the ability to handle any precision either calculation or serialization/deserialization.

So if the service team strongly cares about the precision of decimal it should use @encode to encode it as a string.

Here is the draft proposal:

model Widget {
  @encode("decimalString") // ???
  value: decimal;
}

/cc @bterlson @timotheeguerin

@markcowl
Copy link
Contributor

markcowl commented Jan 8, 2024

note:

@encode(string)
myValue: decimal

@markcowl markcowl added this to the Backlog milestone Jan 8, 2024
@markcowl markcowl added design:needed A design request has been raised that needs a proposal triaged:core and removed needs-area labels Jan 8, 2024
@markcowl markcowl modified the milestones: Backlog, [2024] August Jul 19, 2024
@markcowl
Copy link
Contributor

markcowl commented Aug 9, 2024

Closing as fixed

@markcowl markcowl closed this as completed Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design:needed A design request has been raised that needs a proposal triaged:core
Projects
None yet
Development

No branches or pull requests

3 participants