Skip to content

Fix bug that C# property not nullable when specified via reference#1682

Merged
RicoSuter merged 1 commit into
RicoSuter:masterfrom
markm77:master
Jun 12, 2024
Merged

Fix bug that C# property not nullable when specified via reference#1682
RicoSuter merged 1 commit into
RicoSuter:masterfrom
markm77:master

Conversation

@markm77

@markm77 markm77 commented Mar 14, 2024

Copy link
Copy Markdown
Contributor

This fixes a bug that has been found using both NSwag and NJsonSchema. Essentially when GenerateNullableReferenceTypes and GenerateOptionalPropertiesAsNullable are both true, these settings are not respected for an optional object property provided via a reference ($ref) and the resulting C# property is not optional.

I believe this may solve multiple issues raised in both NSwag and NJsonSchema repos, for example:
#1305
RicoSuter/NSwag#4280 (maybe?)

I've added a test that reproduces the problem and passes with the fix.

@markm77

markm77 commented Apr 22, 2024

Copy link
Copy Markdown
Contributor Author

Hi @RicoSuter , is there anything I can do to get this fix into the repo? It's quite a pain to use a local version of NSwag every time to avoid this bug.

@RicoSuter RicoSuter merged commit 4c76ebd into RicoSuter:master Jun 12, 2024
@markm77

markm77 commented Jun 12, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for merging @RicoSuter !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants