Uh oh!
There was an error while loading. Please reload this page.
feat: add JsonConverter for OpenApiSchema System.Text.Json serialization - #2915
Conversation
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Let's a couple of comments to help get this merged
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR introduces first-class System.Text.Json (de)serialization support for OpenApiSchema by adding a dedicated JsonConverter<OpenApiSchema> that emits/consumes OpenAPI wire-format JSON instead of default reflection-based output, addressing the need described in #2299.
Changes:
- Added
OpenApiSchemaJsonConverterwith version-targeted serialization (defaulting to OpenAPI 3.2) and deserialization support. - Added unit tests validating basic serialize/deserialize and version-specific behavior.
- Updated public API baselines to include the new converter; also includes an encoding-only change to
global.json.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Microsoft.OpenApi/Converters/OpenApiSchemaJsonConverter.cs | New converter implementation for OpenApiSchema using OpenAPI wire-format I/O. |
test/Microsoft.OpenApi.Tests/Converters/OpenApiSchemaJsonConverterTests.cs | New unit tests covering basic serialization/deserialization scenarios. |
src/Microsoft.OpenApi/PublicAPI.Unshipped.txt | Declares the newly added public converter API surface. |
global.json | Introduces a UTF-8 BOM at file start (encoding-only change). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thank you for making the changes!
Uh oh!
There was an error while loading. Please reload this page.
Description
Adds
OpenApiSchemaJsonConverter, aSystem.Text.Json.JsonConverter<OpenApiSchema>that produces clean OpenAPI wire format output instead of the default verbose reflection-based serialization.Type of Change
Related Issue(s)
Closes#2299
Changes Made
OpenApiSchemaJsonConverterinsrc/Microsoft.OpenApi/Converters/Read(deserialization) support in addition toWrite(serialization)PublicAPI.Unshipped.txtwith new public API surfaceTesting
Checklist
Versions applicability
Additional Notes
Usage example: