diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index e0dc5001b..89c23baca 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "3.1.0"
+ ".": "3.1.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe45c813e..be4068a9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,14 @@
# Changelog
-## [3.1.0](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.3...v3.1.0) (2025-12-17)
+## [3.1.1](https://github.com/microsoft/OpenAPI.NET/compare/v3.1.0...v3.1.1) (2025-12-18)
+
+### Bug Fixes
+
+* **schema:** always serialize `additionalProperties: false` ([6651c36](https://github.com/microsoft/OpenAPI.NET/commit/6651c36ff341329c053776d65b36b1b7fa9dd3ea))
+* **schema:** always serialize `additionalProperties: false` ([e36fc95](https://github.com/microsoft/OpenAPI.NET/commit/e36fc9565bce42916eb7bf64d1f74d491dd1f407))
+
+## [3.1.0](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.3...v3.1.0) (2025-12-17)
### Features
@@ -9,7 +16,6 @@
## [3.0.3](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.2...v3.0.3) (2025-12-16)
-### Bug Fixes
* load JSON documents that are preceded by multiple whitespace ([6461bac](https://github.com/microsoft/OpenAPI.NET/commit/6461bac01c4176424210e9ac249698f665a514a6))
* non-seekable json streams would fail to load as a document ([2436d73](https://github.com/microsoft/OpenAPI.NET/commit/2436d7382bfbf8b9ba501d88f682e952bdf27146))
@@ -43,8 +49,20 @@
* adds support for OpenAPI 3.2.0 ([765a8dd](https://github.com/microsoft/OpenAPI.NET/commit/765a8dd4d6efd1a31b6a76d282ccffa5877a845a))
-## [2.3.12](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.11...v2.3.12) (2025-12-15)
+## [2.4.1](https://github.com/microsoft/OpenAPI.NET/compare/v2.4.0...v2.4.1) (2025-12-18)
+### Bug Fixes
+
+* **schema:** always serialize `additionalProperties: false` ([6651c36](https://github.com/microsoft/OpenAPI.NET/commit/6651c36ff341329c053776d65b36b1b7fa9dd3ea))
+* **schema:** always serialize `additionalProperties: false` ([e36fc95](https://github.com/microsoft/OpenAPI.NET/commit/e36fc9565bce42916eb7bf64d1f74d491dd1f407))
+
+## [2.4.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.12...v2.4.0) (2025-12-17)
+
+### Features
+
+* Add `type: "null"` downcasting when in oneOf and anyOf for OpenAPI v3 ([782cf8d](https://github.com/microsoft/OpenAPI.NET/commit/782cf8d1ff8166e3c7be706e08dabf168b9616a4))
+
+## [2.3.12](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.11...v2.3.12) (2025-12-15)
### Bug Fixes
diff --git a/Directory.Build.props b/Directory.Build.props
index 11a996a34..5aba3b052 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
- 3.1.0
+ 3.1.1
diff --git a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
index 7556c1f30..c2e1b1908 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
@@ -494,9 +494,8 @@ private void SerializeInternal(IOpenApiWriter writer, OpenApiSpecVersion version
AdditionalProperties,
callback);
}
- // true is the default in earlier versions 3, no need to write it out
- // boolean value is only supported for version 3 and earlier (version 2 is implemented in the other serialize method, the condition is a failsafe)
- else if (!AdditionalPropertiesAllowed && version <= OpenApiSpecVersion.OpenApi3_0)
+ // true is the default, no need to write it out
+ else if (!AdditionalPropertiesAllowed)
{
writer.WriteProperty(OpenApiConstants.AdditionalProperties, AdditionalPropertiesAllowed);
}
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
index d485901af..2f99ae864 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
@@ -755,8 +755,11 @@ public async Task SerializeAdditionalPropertiesAllowedAsV3PlusDefaultDoesNotEmit
Assert.True(JsonNode.DeepEquals(JsonNode.Parse(expected), JsonNode.Parse(actual)));
}
- [Fact]
- public async Task SerializeAdditionalPropertiesAllowedAsV3FalseEmits()
+ [Theory]
+ [InlineData(OpenApiSpecVersion.OpenApi3_0)]
+ [InlineData(OpenApiSpecVersion.OpenApi3_1)]
+ [InlineData(OpenApiSpecVersion.OpenApi3_2)]
+ public async Task SerializeAdditionalPropertiesAllowedAsV3PlusFalseEmits(OpenApiSpecVersion version)
{
var expected = @"{ ""additionalProperties"": false }";
// Given
@@ -766,7 +769,7 @@ public async Task SerializeAdditionalPropertiesAllowedAsV3FalseEmits()
};
// When
- var actual = await schema.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi3_0);
+ var actual = await schema.SerializeAsJsonAsync(version);
// Then
Assert.True(JsonNode.DeepEquals(JsonNode.Parse(expected), JsonNode.Parse(actual)));