Skip to content

[release/10.0] Update OpenApi to 2.12 - #68468

Merged
wtgodbe merged 5 commits into
release/10.0from
dev/ygerges/openapi-2.12
Aug 13, 2026
Merged

wtgodbe merged 5 commits into
release/10.0from
dev/ygerges/openapi-2.12

Conversation

@Youssef1313

Copy link
Copy Markdown
Member

No description provided.

@Youssef1313
Youssef1313 marked this pull request as ready for review August 13, 2026 04:40
@Youssef1313
Youssef1313 requested a review from wtgodbe as a code owner August 13, 2026 04:40
Copilot AI lite review requested due to automatic review settings August 13, 2026 04:40
@Youssef1313
Youssef1313 requested a review from a team as a code owner August 13, 2026 04:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repository’s dependency version constraints for the Microsoft.OpenApi and Microsoft.OpenApi.YamlReader packages to allow resolving OpenApi 2.12.x (while still preventing 3.x).

Changes:

  • Bumped MicrosoftOpenApiVersion minimum from 2.7.5 to 2.12.0 (range remains < 3.0.0).
  • Bumped MicrosoftOpenApiYamlReaderVersion minimum from 2.7.5 to 2.12.0 (range remains < 3.0.0).

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@Youssef1313 Youssef1313 changed the title Update OpenApi to 2.12 [release/10.0] Update OpenApi to 2.12 Aug 13, 2026
@Youssef1313

Copy link
Copy Markdown
Member Author

@copilot OpenApiSchema.Example is now deprecated. Update the usage to OpenApiSchema.Examples.

Copilot AI requested a review from a team as a code owner August 13, 2026 09:31

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@copilot OpenApiSchema.Example is now deprecated. Update the usage to OpenApiSchema.Examples.

Done in a02b7c9 — the XML comment schema transformer now sets schema.Examples = [example] instead of the deprecated schema.Example. Generator snapshots and tests were updated, along with the OpenAPI 3.1 integration snapshots (3.1 now serializes examples: [...]; 3.0 output is unchanged since a single-item Examples still writes example).

Note: OpenApiDocumentIntegrationTests.VerifyOpenApiDocument(documentName: "schemas-by-ref", version: OpenApi3_0) fails on this branch independently of this change — with 2.12, nullable schema references now serialize as oneOf: [{ "enum": [null], "nullable": true }, { "$ref": ... }] instead of the previous type: object + nullable: true shape. I left that snapshot alone since it's a library behavior change worth a deliberate decision.

{
schema.Description = typeComment.Summary;
if (typeComment.Examples?.FirstOrDefault() is { } jsonString)
if (typeComment.Examples?.FirstOrDefault().Parse() is { } example)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Don't move the Parse call around. Keep the original structure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted in 3b7cb1e — back to if (typeComment.Examples?.FirstOrDefault() is { } jsonString) with schema.Examples = [jsonString.Parse()!];, matching the existing x-ref-example pattern below. Snapshots regenerated.

@Youssef1313

Copy link
Copy Markdown
Member Author

@copilot Fix this failing test OpenApiDocumentIntegrationTests.VerifyOpenApiDocument(documentName: "schemas-by-ref", version: OpenApi3_0) [FAIL]

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

@copilot Fix this failing test OpenApiDocumentIntegrationTests.VerifyOpenApiDocument(documentName: "schemas-by-ref", version: OpenApi3_0) [FAIL]

Fixed in 12b5e07 — updated the OpenAPI 3.0 schemas-by-ref snapshot.

With 2.12, downcasting oneOf: [{ "type": "null" }, { "$ref": ... }] to 3.0 now emits the null branch as { "enum": [null], "nullable": true } inside oneOf instead of hoisting type: object + nullable: true onto the parent schema. The new shape is the canonical 3.0 way to express null (the old form was effectively ignored, since nullable alongside oneOf/$ref siblings isn't honored in 3.0), so I accepted the new output. Full Microsoft.AspNetCore.OpenApi.Tests suite passes: 785 passed, 0 failed.

@wtgodbe wtgodbe added the Servicing-approved Shiproom has approved the issue label Aug 13, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hi @Youssef1313. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

@wtgodbe
wtgodbe merged commit 489d00c into release/10.0 Aug 13, 2026
28 checks passed
@wtgodbe
wtgodbe deleted the dev/ygerges/openapi-2.12 branch August 13, 2026 20:55
@wtgodbe wtgodbe added this to the 10.0.12 milestone Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants