Handle nullability more accurately by Youssef1313 · Pull Request #2933 · microsoft/OpenAPI.NET · GitHub
Skip to content

Handle nullability more accurately - #2933

Merged
Vincent Biret (baywet) merged 15 commits into
microsoft:mainfrom
Youssef1313:dev/ygerges/nullable
Jul 13, 2026
Merged

Handle nullability more accurately#2933
Vincent Biret (baywet) merged 15 commits into
microsoft:mainfrom
Youssef1313:dev/ygerges/nullable

Conversation

@Youssef1313

@Youssef1313 Youssef Fahmy (Youssef1313) commented Jul 9, 2026

Copy link
Copy Markdown
Member

My previous PR was trying to handle nullability for enums specifically. This PR is more generalized to handle nulls more correctly as it was still buggy for non-enums.

In addition, the previous fix for enums didn't also fix all enum scenarios. It only fixed it when we are given "oneOf (null, schemaWithEnum)". But if we are given a schema reference instead, we are not going to add "null" to the reference and we will produce the wrong thing.

I'll leave comments on some specific updated tests to explain.

@Youssef1313
Youssef Fahmy (Youssef1313) requested a review from a team as a code owner July 9, 2026 10:30
Comment thread test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs

@baywet Vincent 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.

Thanks for the contribution!

Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated

@baywet Vincent 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.

Getting closer (I'm only focusing my review on schema object field, and deserialization so far)

Comment thread src/Microsoft.OpenApi/Reader/V3/OpenApiSchemaDeserializer.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V3/OpenApiSchemaDeserializer.cs Outdated
Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V31/OpenApiSchemaDeserializer.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V32/OpenApiSchemaDeserializer.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V32/OpenApiSchemaDeserializer.cs Outdated
@baywet

Copy link
Copy Markdown
Member

Comment thread src/Microsoft.OpenApi/Models/OpenApiSchema.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V2/OpenApiSchemaDeserializer.cs Outdated
Comment thread src/Microsoft.OpenApi/Reader/V2/OpenApiSchemaDeserializer.cs Outdated
This was referenced Sep 3, 2026
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