Skip to content

Fix null examples being represented as the string null#3788

Merged
martincostello merged 3 commits intodomaindrivendev:masterfrom
jgarciadelanoceda:issue_3784_nullExamplesOnXml
Feb 14, 2026
Merged

Fix null examples being represented as the string null#3788
martincostello merged 3 commits intodomaindrivendev:masterfrom
jgarciadelanoceda:issue_3784_nullExamplesOnXml

Conversation

@jgarciadelanoceda
Copy link
Contributor

@jgarciadelanoceda jgarciadelanoceda commented Feb 14, 2026

Fixes #3784.

I think I have found another thing derivated from the OpenAPI.NET upgrate from 1.X to 2.X, previously when there was declared the example as null that example could be shown on the OpenApi document. Now I cannot create a JsonNode from "null" string and the JsonNode not being null so the serializer does not serialize it(A minor thing I believe).

I tried creating a JsonNode from null string many ways but I think it's not possible by design JsonObject.Parse("null")

https://github.com/microsoft/OpenAPI.NET/blob/8bec88013cbb0f86f7f43dfdb039ce83bf83beaf/src/Microsoft.OpenApi/Models/OpenApiSchema.cs#L535

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.93%. Comparing base (756b759) to head (2f72641).
⚠️ Report is 45 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3788      +/-   ##
==========================================
+ Coverage   94.67%   94.93%   +0.25%     
==========================================
  Files         111      111              
  Lines        3868     3886      +18     
  Branches      780      784       +4     
==========================================
+ Hits         3662     3689      +27     
+ Misses        206      197       -9     
Flag Coverage Δ
Linux 94.93% <100.00%> (+0.25%) ⬆️
Windows 94.93% <100.00%> (+0.25%) ⬆️
macOS 94.93% <100.00%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Javier García de la Noceda Argüelles added 2 commits February 14, 2026 09:05
@martincostello
Copy link
Collaborator

I tried creating a JsonNode from null string many ways but I think it's not possible by design JsonObject.Parse("null")

I think that's basically why I ended up changing the code that caused the bug in the first place. I couldn't get it to work and assumed that it wouldn't matter.

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.

[Bug]: Need a way to represent null inside XML comments <example> tag.

2 participants