Skip to content

Fix handling of nullable enums for 3.0 - #2920

Merged
Vincent Biret (baywet) merged 4 commits into
microsoft:mainfrom
Youssef1313:nullable-enum
Jul 3, 2026
Merged

Fix handling of nullable enums for 3.0#2920
Vincent Biret (baywet) merged 4 commits into
microsoft:mainfrom
Youssef1313:nullable-enum

Conversation

@Youssef1313

Copy link
Copy Markdown
Member

Previously, this scenario wasn't producing a type and wasn't producing a null value in the enum array.

This fixes it so that they are produced.

In the future, we could also avoid adding a oneOf with a single element in this scenario.

@Youssef1313
Youssef Fahmy (Youssef1313) requested a review from a team as a code ownerJuly 1, 2026 16:35
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Fixed
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Fixed
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment threadtest/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs Outdated
Comment threadtest/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs Outdated
Comment threadtest/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Fixed

@baywetVincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

@Youssef1313

Copy link
Copy Markdown
MemberAuthor

Vincent Biret (@baywet) Is there anything remaining to get this merged? Would we have a new version released before .NET 11 Preview 7 so that we try to get that in aspnetcore repo and possibly build some fixes on our side on top of this?

Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Dismissed
Comment threadsrc/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated

@baywetVincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

This was referenced Aug 8, 2026
Youssef Fahmy (Youssef1313) added a commit to Youssef1313/OpenAPI.NET that referenced this pull request Aug 11, 2026
* Fix handling of nullable enums for 3.0
* Address comments
* Add
* Use JsonNullSentinel.JsonNull
Sign up for freeto 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.

4 participants

@Youssef1313@baywet@DeagleGross@github-advanced-security