asyncapi / modelina

A library for generating typed models based on inputs such as AsyncAPI, OpenAPI, and JSON Schema documents with high customization
https://modelina.org
Apache License 2.0
318 stars 184 forks source link

Properties with type integer and format int64 generate properties of type int instead of type long using the C# generator #2053

Closed jespitae closed 4 months ago

jespitae commented 5 months ago

Describe the bug.

The following piece of asyncapi specification: image

Results in the following property: image

Expected behavior

We would expect that this asyncapi specification would have generated a property of type long. When using the Java generator it does result in Long properties.

Screenshots

Screenshots provided earlier.

How to Reproduce

We used version 2.0.2 of the asyncapi cli and version 3.5.3 of modelina and ran the following command: asyncapi generate models csharp ./asyncapi.json --namespace=Test --output=Models --csharpSystemJson Our async api specification is defined in version 2.4.0.

🥦 Browser

None

👀 Have you checked for similar open issues?

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

github-actions[bot] commented 5 months ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

jonaslagoni commented 5 months ago

We have something similar for Java: https://github.com/asyncapi/modelina/blob/0db19cc2e99ad0bdb09b961a91d5511d061077f0/src/generators/java/JavaConstrainer.ts#L155 we just need to adapt: https://github.com/asyncapi/modelina/blob/0db19cc2e99ad0bdb09b961a91d5511d061077f0/src/generators/csharp/CSharpConstrainer.ts#L55C12-L55C33 for C#

Happy to accept a PR @jespitae 🤙 Please target the next branch 🙂

jespitae commented 5 months ago

Hi,

I made a PR with the required change: https://github.com/asyncapi/modelina/pull/2054 Thanks for the quick response!