Dependencies: Hold Microsoft.OpenApi at 2.9.0 on the v17 line (do not auto-bump) - #23455
Dependencies: Hold Microsoft.OpenApi at 2.9.0 on the v17 line (do not auto-bump)#23455AndyButland wants to merge 1 commit into
Conversation
|
Claude finished @AndyButland's task in 3m 24s —— View job PR ReviewTarget: Bumps
Important
Suggestions
Approved with Suggestions for improvementGood to go, but please carefully consider the importance of the suggestions. The key concern — |
There was a problem hiding this comment.
Pull request overview
This PR upgrades Microsoft.OpenApi to 2.11.0 on the v17 line and updates the committed Delivery API OpenAPI 3.0 contract expectation so OpenApiContractTest matches the newly generated output.
Changes:
- Bump the centrally managed
Microsoft.OpenApiversion 2.9.0 → 2.11.0. - Keep
Umbraco.Web.UI’s explicitMicrosoft.OpenApireference aligned at 2.11.0 (it opts out of central package management). - Regenerate the Delivery API OpenAPI 3.0 contract string used by
OpenApiContractTest, reflecting nullable-schema serialization changes in 2.11.0.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Directory.Packages.props |
Updates the central Microsoft.OpenApi pin to 2.11.0. |
src/Umbraco.Web.UI/Umbraco.Web.UI.csproj |
Updates the explicit Microsoft.OpenApi reference to 2.11.0 for the project that doesn’t use central package management. |
tests/Umbraco.Tests.Integration/Umbraco.Core/DeliveryApi/OpenApiContractTest.cs |
Updates the expected OpenAPI 3.0 contract output to match 2.11.0 generation (notably around nullable serialization). |
| "additionalProperties": { | ||
| "nullable": true | ||
| "enum": [ | ||
| null | ||
| ] | ||
| } |
| @@ -1416,8 +1420,7 @@ | |||
| { | |||
| "$ref": "#/components/schemas/ImageFocalPointModel" | |||
| } | |||
| ], | |||
| "nullable": true | |||
| ] | |||
Microsoft.OpenApi 2.10.0+ reworked OpenAPI 3.0 nullability serialization (regression confirmed in 2.11.0): nullable, type-less schemas emit "enum": [null] and nullable oneOf $refs drop "nullable" entirely, which corrupts the generated Delivery API 3.0 contract (fails OpenApiContractTest) and misleads client code generation. The v17 line generates OpenAPI 3.0 via Swashbuckle, so it is affected; the v18 line uses Microsoft.AspNetCore.OpenApi (3.1) and is not. Add a HOLD comment to the pin (central + Umbraco.Web.UI inline) so the routine dependency-update process does not bump it, referencing the upstream tracking issue microsoft/OpenAPI.NET#2967. 2.9.0 is already patched for CVE-2026-49451, so holding carries no security cost. Comment-only; no version change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9fe0c5e to
595fab9
Compare
|
Hold comment is now added to #23453, due to go into |
|
|
@AndyButland Can you please clarify more the issue you're facing? The Note that the Object Model reflects OpenAPI 3.2 semantics, which is mostly JSON Schema DRAFT 2020-12. So, in 3.2 (and DRAFT 2020-12), the above schema maps to: {
"type": "null"
}Such schema literally means that only null is allowed, and so |
|
I've prepared a standalone repository that shows the difference in output we are seeing @Youssef1313, you can find it here: https://github.com/AndyButland/OpenApiNullableRepro It surfaced here at Umbraco as a failure in an integration test where we compare the actual output with an expected one, and that flagged the changes that this smaller reproduction shows. |
|
@AndyButland My question isn't about showing the output difference. The output difference that was introduced is intentional. The question is, why do you think the output is wrong, and if there are any tools you feed the output to which broke you (e.g, do you feed the document to some client generator, and it started producing something invalid? Can I have more details on that?) |
|
@AndyButland fwiw, the implementation of SetNullable on Swashbuckle itself was buggy and wrong. This appears to have gotten fixed in domaindrivendev/Swashbuckle.AspNetCore#3976 |
|
OK, that I don't have. We have this API for customers to use when building headless application using content managed in Umbraco. We don't actively use it ourselves, but we do have integration tests verifying that the output is as we expect, and we found this discrepancy when upgrading to Microsoft.OpenApi 2.11. It may well be harmless for all clients, but at least for now, we've held on 2.9 to avoid any unexpected changes for a client relying on the previous output. |



Description
Keeps
Microsoft.OpenApiheld at 2.9.0 on the v17 line and documents why, so the routine dependency-update process (umb-update-server-dependencies-for-minor) does not bump it. Targetsv17/dev.This PR started life as the deferred 2.11.0 upgrade + Delivery API contract regeneration (the follow-up promised in #23453). On review, that upgrade is being kept back rather than merged — see below — so the PR now only adds a
HOLDcomment to the pin (central +Umbraco.Web.UIinline). Comment-only; no version change.Why hold
Microsoft.OpenApi2.10.0+ reworked how nullable schemas serialize to OpenAPI 3.0, regressing the Delivery API 3.0 contract (which the v17 line generates via Swashbuckle):ApiElement.Properties/ApiMedia.Properties(IDictionary<string, object?>) — emit"enum": [null], which in JSON-Schema terms constrains every value to null, instead of"nullable": true;$refs wrapped inoneOf(mediafocalPoint,coordinates) lose the"nullable": truemarker entirely, so the contract advertises them as non-nullable even though they are nullable at runtime (ImageFocalPoint?,ImageCropCoordinates?).Both mislead downstream client generation/validation. Upstream this is a deliberate OpenAPI 3.0.3 spec-compliance change (
nullableonly applies whentypeis present in the same schema object) and is tracked at microsoft/OpenAPI.NET#2967. As of now there is no fixed 2.x release (2.11.0 is the latest).No security cost to holding: 2.9.0 is itself the patched version for CVE-2026-49451 / GHSA-v5pm-xwqc-g5wc. The 18.x line is unaffected — it generates OpenAPI 3.1 via
Microsoft.AspNetCore.OpenApi, which doesn't exercise the changed 3.0 path.Change
Directory.Packages.propsandsrc/Umbraco.Web.UI/Umbraco.Web.UI.csproj: add aHOLD/ do-not-bump comment to theMicrosoft.OpenApi2.9.0 pin, referencing Regression: broken nullability after update to v3.9.0 microsoft/OpenAPI.NET#2967. No version change.When to revisit
Once the 2.x track ships a fix (watch #2967), do the 2.11.0+ upgrade and regenerate the Delivery API contract in a fresh PR. If a security advisory forces
Microsoft.OpenApioff 2.9.0 before then, a Swashbuckle schema-filter workaround will be needed to restore the 3.0 nullable output.Testing
Solution should build and CI checks pass. Comment-only change; no functional impact.