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

float is emitted as object #4683

Closed
joheredi opened this issue May 7, 2024 · 1 comment · Fixed by #4707
Closed

float is emitted as object #4683

joheredi opened this issue May 7, 2024 · 1 comment · Fixed by #4707
Assignees
Labels
DPG/RLC v2.1 Post Gallium work DPG v3 Version 3 of AutoRest C# generator.

Comments

@joheredi
Copy link
Member

joheredi commented May 7, 2024

Describe the issue or request
When a spec has a float type it gets generated as object

model Foo {
   TestNonNullableFloat: float;
   TestNullableFloat: float | null;
   TestNonNullableFloat32: float32;
   TestNullableFloat32: float32 | null;
   TestNonNullableFloat64: float64;
   TestNullableFloat64: float64 | null;
}

image

Describe your ideas for solutions
Maybe generate the max possible representation which would be decimal

/cc: @m-nash

@ArcturusZhang
Copy link
Member

ArcturusZhang commented May 15, 2024

Hi @joheredi per typespec document, float is the base type of float32 and float64.
We did not handle this particular kind previously therefore it is emitted as object.
Since it is the base, from value's perspective, I think we should generate this type as double.
What do you think? @joheredi @m-nash

FYI we are doing the same for integer which is the base type of all integer types, and it is generated as long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DPG/RLC v2.1 Post Gallium work DPG v3 Version 3 of AutoRest C# generator.
Projects
None yet
2 participants