[BUG] Generated JsonConverter tries to Deserialize enums as dynamic in the C# generator #2063
Closed
2 tasks done
Labels
bug
Something isn't working
Describe the bug.
The C# generator generates a JsonConverter using SystemTextJson, that tries to deserialize the enums as dynamic.
The enum looks like this:
Next to the enum an extension method is generated:
The json converter tries to deserialize the enum as follows:
This results in the following error when trying to deserialize the enum:
The best overloaded method match for 'CBS.Viewer.Integration.Events.EnvironmentExtensions.ToEnvironment(string)' has some invalid arguments
Expected behavior
We would expect the resulting json converter to look like this:
Screenshots
Screenshot provided throughout.
How to Reproduce
Our asyncapi spec for the enum looks like this:
The property on one of our events:
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
Mozilla Firefox
👀 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!
The text was updated successfully, but these errors were encountered: