-
-
Notifications
You must be signed in to change notification settings - Fork 64
Fix #580: Nullable strings marked correctly #921
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,6 +62,12 @@ public CustomCSharpClientGenerator Create() | |||||||||||
| settings.CodeGeneratorSettings, | ||||||||||||
| generator.Settings.CSharpGeneratorSettings); | ||||||||||||
|
|
||||||||||||
| // Auto-enable optional properties as nullable when nullable reference types enabled | ||||||||||||
| if (generator.Settings.CSharpGeneratorSettings.GenerateNullableReferenceTypes) | ||||||||||||
| { | ||||||||||||
| generator.Settings.CSharpGeneratorSettings.GenerateOptionalPropertiesAsNullable = true; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+65
to
+70
|
||||||||||||
| // Auto-enable optional properties as nullable when nullable reference types enabled | |
| if (generator.Settings.CSharpGeneratorSettings.GenerateNullableReferenceTypes) | |
| { | |
| generator.Settings.CSharpGeneratorSettings.GenerateOptionalPropertiesAsNullable = true; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change alters nullability generation behavior but there’s no regression test asserting that an OpenAPI schema with
type: string+nullable: true(and/or an optional string property) generatesstring?when nullable reference types are enabled. Please add/extend a unit test that checks the generated DTO/contract property type (not just build success) to prevent this from regressing again.