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 decimal type in RLC #2170

Merged
merged 7 commits into from
Dec 20, 2023
Merged

Conversation

MaryGao
Copy link
Member

@MaryGao MaryGao commented Dec 19, 2023

fixes #2157
Support decimal in RLC - map the decimal to number in JS directly, and will

  • add below comments in generated code
Please note the field was supposed to be a decimal but JavaScript does not have a native 'BigDecimal' data type.
So it was converted to a number instead. It is recommended to use a third-party library like 'decimal.js' to handle 
any calculations.
  • report a warning
Please note the decimal type will be converted to number. If you strongly care about precision you can use @encode to encode it as a string for the property - {your prop name}.

Encoding as string is still pending typespec discussion microsoft/typespec#2762.

@MaryGao MaryGao marked this pull request as ready for review December 19, 2023 09:30
Copy link
Member

@joheredi joheredi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments but look fine otherwise

@MaryGao MaryGao merged commit 1bd68af into Azure:main Dec 20, 2023
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support decimal type from typespec
4 participants