AsterNET.ARI icon indicating copy to clipboard operation
AsterNET.ARI copied to clipboard

Copy pasta in mailboxes methods Update / UpdateAsync

Open dvakor opened this issue 7 years ago • 2 comments

Just look at source code and found some copy pasta

https://github.com/skrusty/AsterNET.ARI/blob/master/AsterNET.ARI/ARI_1_0/Actions/MailboxesActions.cs#L77

Methods Update \ UpdateAsync in Mailboxes, have requered params oldMessages, newMessages also this params are type of "int" and that cannot be null, but method have conditions like

if (oldMessages != null)

dvakor avatar Nov 16 '18 02:11 dvakor

Hi, this isn't a copy paste issue, as the code is generated from the swagger definition. The issue here is the generator isn't creating a type of int?. Feel free to submit a PR if you're happy to fix the issue in the code generator.

skrusty avatar Nov 16 '18 16:11 skrusty

Yea, I've had that before with Swagger in other projects too.

It's not actually an error, it's just that Swagger isn't perfect and it cannot always 100% of the time get the data types exactly right, especially will nullable types which is what your on about here.

int? means that you have an integer value, which is allowed to be set to "null", but int by default is a value type and normally cannot be set to "null", even the .net compiler get's it wrong occasionally, which is why the C#8 compiler and .NET core 3 are introducing some new compiler directives to try and mitigate scenarios like this.

shawty avatar Sep 18 '19 16:09 shawty