Skip to content

Conversation

@lauraneto
Copy link
Contributor

@lauraneto lauraneto commented Nov 21, 2025

This pull request updates Swashbuckle to v10.

Main changes

  • Namespace changes
  • Nullability changes - almost all components of the Open API document are now nullable, so if we want to add or adjust we need to make sure they are initialized first.
  • There used to be specific types for values (OpenApiString, OpenApiArray, ...) these all use JsonNode now.
  • A lot of places used to reference implementations, like OpenApiParameter, but now reference the interface IOpenApiParameter
  • The schema types are now an enum (String, Object, Null, ...) and not just a simple string
  • There is no IsNullable property anymore, in the Type you mention both types, like Type = JsonSchemaType.Array | JsonSchemaType.Null.

Testing
Compare the generated Management and Delivery API swagger documents

@lauraneto lauraneto changed the base branch from main to release/17.0 November 21, 2025 12:00
Didn't notice that these classes were internal, so tried keeping compatibility, but it wasn't needed.
@lauraneto lauraneto mentioned this pull request Nov 21, 2025
1 task
@lauraneto lauraneto marked this pull request as ready for review November 21, 2025 13:10
Copilot AI review requested due to automatic review settings November 21, 2025 13:10
Copilot finished reviewing on behalf of lauraneto November 21, 2025 13:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request upgrades Swashbuckle from v9.0.6 to v10.0.1, implementing breaking API changes from the OpenAPI library. The update modernizes the codebase to use new interface-based patterns, enum-based type definitions, and JSON node-based value representations.

Key Changes

  • Namespace consolidation from Microsoft.OpenApi.Models to Microsoft.OpenApi across all OpenAPI-related code
  • Migration from concrete types to interface-based types (e.g., IOpenApiSchema, IOpenApiParameter) with appropriate casting patterns
  • Schema type system updated from strings to JsonSchemaType enum flags, including new nullability patterns using flag combinations
  • OpenAPI example values now use JsonNode types instead of specialized OpenApiString/OpenApiArray classes
  • Security scheme references simplified using new OpenApiSecuritySchemeReference constructor

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Directory.Packages.props Updated Swashbuckle.AspNetCore package version from 9.0.6 to 10.0.1
templates/UmbracoExtension/Composers/UmbracoExtensionApiComposer.cs Updated namespace import from Microsoft.OpenApi.Models to Microsoft.OpenApi
src/Umbraco.Web.UI.Client/src/packages/core/backend-api/types.gen.ts Regenerated TypeScript types reflecting removed DocumentTypePermissionPresentationModel and new query parameters
src/Umbraco.Web.UI.Client/src/packages/core/backend-api/sdk.gen.ts Added deprecation marker for GetHelp endpoint
src/Umbraco.Cms.Api.Management/OpenApi/RequireNonNullablePropertiesSchemaFilter.cs Updated to use IOpenApiSchema interface with casting, new nullability check using JsonSchemaType flags
src/Umbraco.Cms.Api.Management/OpenApi/ReponseHeaderOperationFilter.cs Migrated to interface types and JsonSchemaType enum for header schemas
src/Umbraco.Cms.Api.Management/OpenApi/NotificationHeaderFilter.cs Updated notification header schema to use JsonSchemaType flags and OpenApiSchemaReference
src/Umbraco.Cms.Api.Management/OpenApi/BackOfficeSecurityRequirementsOperationFilterBase.cs Simplified security scheme references using OpenApiSecuritySchemeReference constructor
src/Umbraco.Cms.Api.Management/OpenApi.json Regenerated OpenAPI document with new Help endpoint, foldersOnly parameters, removed DocumentTypePermissionPresentationModel, and added tags section
src/Umbraco.Cms.Api.Management/Configuration/ConfigureUmbracoManagementApiSwaggerGenOptions.cs Updated namespace and added readonly modifier to field
src/Umbraco.Cms.Api.Delivery/Filters/SwaggerMediaDocumentationFilter.cs Migrated example values from OpenApiString/OpenApiArray to JsonNode types
src/Umbraco.Cms.Api.Delivery/Filters/SwaggerDocumentationFilterBase.cs Updated parameter filter to use interface types with casting, migrated examples to JsonNode
src/Umbraco.Cms.Api.Delivery/Filters/SwaggerContentDocumentationFilter.cs Updated header schemas to JsonSchemaType enum and migrated examples to JsonNode
src/Umbraco.Cms.Api.Delivery/Configuration/ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions.cs Updated security scheme references and added null-safety for Components collections
src/Umbraco.Cms.Api.Delivery/Configuration/ConfigureUmbracoDeliveryApiSwaggerGenOptions.cs Updated namespace import
src/Umbraco.Cms.Api.Common/OpenApi/SwaggerRouteTemplatePipelineFilter.cs Updated namespace and removed unused Umbraco.Extensions import
src/Umbraco.Cms.Api.Common/OpenApi/RemoveSecuritySchemesDocumentFilter.cs Added null-conditional operators for safer Components access
src/Umbraco.Cms.Api.Common/OpenApi/MimeTypeDocumentFilter.cs Enhanced null-safety with OfType<> filtering for interface collections
src/Umbraco.Cms.Api.Common/OpenApi/EnumSchemaFilter.cs Updated to use JsonSchemaType enum and JsonNode for enum values
src/Umbraco.Cms.Api.Common/Configuration/ConfigureUmbracoSwaggerGenOptions.cs Updated namespace import
tests/Umbraco.Tests.Integration/Umbraco.Core/DeliveryApi/OpenApiContractTest.cs Updated test expectations to include new tags section in OpenAPI contract

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

I've tested out using a text file comparison and can confirm both management and delivery API Swagger JSON documents are identical apart from the additional output of a tags collection.

E.g. the delivery API has:

  "tags": [
    {
      "name": "Content"
    },
    {
      "name": "Media"
    }

Given that's an addition rather than any change to existing JSON elements, I can't see that's a concern.

Otherwise I just addressed the Copilot comments by suggesting use of e.g. A is false over !A and A == false, which is just to align with the syntax used in more recent code updates.

@iOvergaard iOvergaard added dependencies Pull requests that update a dependency file release/17.0.0 release/17.0.0-rc4 labels Nov 24, 2025
@iOvergaard iOvergaard changed the title Update Swashbuckle to v10 Dependencies: Updates Swashbuckle to v10 Nov 24, 2025
@iOvergaard iOvergaard merged commit 9beed53 into release/17.0 Nov 24, 2025
23 of 24 checks passed
@iOvergaard iOvergaard deleted the v17/feature/update-swashbuckle-to-v10 branch November 24, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants