-
Notifications
You must be signed in to change notification settings - Fork 210
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
Handling of integer number types with int16
format.
#5611
Comments
Taking a look at the table over at https://learn.microsoft.com/en-us/openapi/kiota/serialization?tabs=csharp#types-mapping, looks like we also do not have a case/mapping for the openapi As we can use From the perspective of previously generated SDKs, the change from properties from |
Thanks for starting this discussion. Happy to see that the mapping table is being useful here. We could probably map it to int32 without getting too much backlash on this one. Yes it uses a bit more memory, but it context it's not what matters the most. The main drawback being people trying to send numbers that are too large in the request body/query parameter and having the API yell at them. Not the greatest experience instead of having the compiler tell you. If we get a lot of feedback this is a problem, we can justify a breaking change. And I believe that int16 is being mapped to int32 when the type is integer (which doesn't mean anything spec-wise), which nobody has complained about to date. The only thing that worries me with this approach is people who were using number/int16 before were getting a double. And that'll be a breaking change. It's most likely better than what they currently had since now they are not risking passing floating point numbers. Maybe we need to add this behaviour behind ecb? (which is going to remain a problem for Microsoft Graph). Let me know what you think with this additional information. |
This is correct. As this was the behavior before the metadata change.
In my head, this behavior is more incorrect, and it could arguably be justified as a fix as mapping an int16 as a double is arguably more incorrect vs mapping it as an integer.
Thanks for the context here. What it looks like is we could update the mapping to map the int16 as a integer(treating it a fix). And follow up with a Kiota 2.0 issue to add support for the int16 types for the serializer/deserializer(Arguably this would be for Go,C#,Java as the other languages map to a the same type). |
Alright, thanks for chiming in. Let's proceed with this fix and no EBC flag. |
2.0 milestone item created at #5615 |
As a follow up to microsoft/OpenAPI.NET.OData#593
The
integer
types were replaced in the openapi description withnumber
types which presented the a inconsistency in the generation. Due to the case at the line below.https://github.com/microsoft/kiota/blob/a14fb8130851192316238393e4958844069967b8/src/Kiota.Builder/KiotaBuilder.cs#L1159C19-L1159C26
Properties with the type as
integer
and format asint16
would be projected as typeinteger
in the codeDom.However changing the type to
integer
results in the type being projected asdouble
as opposed tointeger
before as there is no case to handle theinteger
withint16
format.The text was updated successfully, but these errors were encountered: