RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.78k stars 1.29k forks source link

Int64 don't get compiled to long - .NET 5.0 #3416

Open ArcaneDiver opened 3 years ago

ArcaneDiver commented 3 years ago

Hi, i'm using a swagger schema where i use types like

type: integer
format: int64

but when i generate the code it generates property with type int instead of long.

I'm actually generating the code from the npm cli so i run: nswag run config.nswag /runtime:Net50

My .net version in 5.0.202 and my nswag version is 13.10.9.0

Thanks in advance.

RicoSuter commented 3 years ago

https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema.CodeGeneration.CSharp/CSharpTypeResolver.cs#L221

https://github.com/RicoSuter/NJsonSchema/blob/a9e7b34da7abebb8803bcb51566a0f39c502312b/src/NJsonSchema/JsonFormatStrings.cs#L39

looks good on quick check...

ArcaneDiver commented 3 years ago

Hi, i just discovered that some field had the long type and some has just int. The difference in the swagger schema was:

So probably the library doesn't correctly resolve references...

RicoSuter commented 2 years ago

Probably it's a problem with $ref, needs to be verified with a unit test in NJsonSchema.

VusalDev commented 5 months ago

Still waiting for resolving this problem