-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[BUG] [c-sharp] Inconsistency in default values discriminator #6225
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Did some debugging on the default value, found a bug in the generator. I've opened PR #6232 for that. The inconsistency of the attributes is caused by #5680 which forces the |
Bug Report Checklist
Description
Using the C# generator I found some inconsistencies in the default values for classes with a discriminator with a mapping.
When the discriminator propertyName is in camelCase, I notice the following:
default(string)
When the discriminator propertyname is in PascalCase, I notice the following:
Expected:
JsonConverter
converterParameters
andDatamember
name
to matchopenapi-generator version
openapi-generator-cli-4.3.1.jar
OpenAPI declaration file content or url
Two files, one with camelCase, one with PascalCase:
https://gist.github.com/thommy101/39b65b3a365a09d3738f26edc3e1682b
Command line used for generation
java -jar openapi-generator-cli-4.3.1.jar generate -i camelCase.yaml -g csharp -o camelCase
java -jar openapi-generator-cli-4.3.1.jar generate -i pascalCase.yaml -g csharp -o pascalCase
Steps to reproduce
JsonConverter
-attribute on the class andDataMember
-attribute on the propertyClassName
, but not having a default value for Cat's constructor parameterclassName
(default(string)
)JsonConverter
-attribute on the class andDatamember
-attribute on the propertyClassName
, but having a correct default value for Cat's constructor parameterclassName
("Cat"
)Related issues/PRs
#3308
#5680: Related because forcing the JsonConverter attribute to camelCase and because of the comment:
Suggest a fix
The text was updated successfully, but these errors were encountered: