diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 4135aabc2..9d55602b3 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -76,7 +76,7 @@ jobs: working-directory: ./performance/benchmark - name: Publish benchmark results - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: if-no-files-found: error name: benchmark-results diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4d2b02b5e..3aedaf18b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.3.8" + ".": "2.3.9" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d1854c1..f97968659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [2.3.9](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.8...v2.3.9) (2025-11-06) + + +### Bug Fixes + +* a bug where null sentinel value would appear in YAML documents ([0e864c7](https://github.com/microsoft/OpenAPI.NET/commit/0e864c73791b8610a95f06da9fbb44bfa1cf75a9)) +* a bug where null sentinel value would appear in YAML documents ([15618e1](https://github.com/microsoft/OpenAPI.NET/commit/15618e1f6a79874ae61dc31e3bcd5e1f3177d7ff)) + ## [2.3.8](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.7...v2.3.8) (2025-10-27) diff --git a/Directory.Build.props b/Directory.Build.props index ea4943006..8ef14df8e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -12,7 +12,7 @@ https://github.com/Microsoft/OpenAPI.NET © Microsoft Corporation. All rights reserved. OpenAPI .NET - 2.3.8 + 2.3.9 diff --git a/performance/benchmark/PerformanceTests.csproj b/performance/benchmark/PerformanceTests.csproj index 78e1a5cd4..b3c779c35 100644 --- a/performance/benchmark/PerformanceTests.csproj +++ b/performance/benchmark/PerformanceTests.csproj @@ -14,8 +14,8 @@ CA1822 - - + + diff --git a/src/Microsoft.OpenApi.YamlReader/YamlConverter.cs b/src/Microsoft.OpenApi.YamlReader/YamlConverter.cs index 5acf0c007..710f20c6b 100644 --- a/src/Microsoft.OpenApi.YamlReader/YamlConverter.cs +++ b/src/Microsoft.OpenApi.YamlReader/YamlConverter.cs @@ -63,6 +63,10 @@ public static YamlNode ToYamlNode(this JsonNode json) { JsonObject obj => obj.ToYamlMapping(), JsonArray arr => arr.ToYamlSequence(), + JsonValue nullVal when JsonNullSentinel.IsJsonNullSentinel(nullVal) => new YamlScalarNode("null") + { + Style = ScalarStyle.Plain + }, JsonValue val => val.ToYamlScalar(), _ => throw new NotSupportedException("This isn't a supported JsonNode") }; diff --git a/test/Microsoft.OpenApi.Readers.Tests/YamlConverterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/YamlConverterTests.cs index 70073bfaa..b2f0e0f5d 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/YamlConverterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/YamlConverterTests.cs @@ -2,6 +2,7 @@ using Microsoft.OpenApi.YamlReader; using SharpYaml; using SharpYaml.Serialization; +using System; using System.IO; using System.Text.Json.Nodes; using Xunit; @@ -302,10 +303,18 @@ from openai import OpenAI var jsonNode = ConvertYamlStringToJsonNode(yamlInput); var convertedBack = jsonNode.ToYamlNode(); var convertedBackOutput = ConvertYamlNodeToString(convertedBack); - + // Then Assert.Equal(yamlInput.MakeLineBreaksEnvironmentNeutral(), convertedBackOutput.MakeLineBreaksEnvironmentNeutral()); } + [Fact] + public void ItDoesNotSerializeTheSentinelValue() + { + var yamlValue = JsonNullSentinel.JsonNull.ToYamlNode(); + + var scalarNode = Assert.IsType(yamlValue); + Assert.Equal("null", scalarNode.Value, StringComparer.OrdinalIgnoreCase); + } private static JsonNode ConvertYamlStringToJsonNode(string yamlInput) {