Skip to content

Templates: Add direct Swashbuckle dependency to extension template (closes #21864)#21869

Merged
nikolajlauridsen merged 2 commits intomainfrom
v17/bugfix/21864-add-swashbuckle-reference-to-extension-template
Mar 10, 2026
Merged

Templates: Add direct Swashbuckle dependency to extension template (closes #21864)#21869
nikolajlauridsen merged 2 commits intomainfrom
v17/bugfix/21864-add-swashbuckle-reference-to-extension-template

Conversation

@AndyButland
Copy link
Copy Markdown
Contributor

@AndyButland AndyButland commented Feb 23, 2026

Description

Addresses: #21864 which describes how conflicting Swashbuckle dependencies can be resolved leading to a situation where the APIs cannot be shown on the Swagger document.

This would be temporarily resolved by #21860 which updates the Swashbuckle.AspNetCore dependency to the latest version; but the problem could recur.

The problem occurs because the extension template code directly uses types from Swashbuckle.AspNetCore (SwaggerGenOptions) and Microsoft.OpenApi (OpenApiInfo) in the composer to register custom Swagger documents.

With Swashbuckle was only a transitive dependency via the Umbraco packages, NuGet could resolve it to a different version than the host site project. When that happened, the differing Microsoft.OpenApi versions (a transitive dependency of Swashbuckle) would conflict at runtime, causing the extension's custom Swagger documents to not appear.

Other transitive Umbraco dependencies don't have this problem because extension code doesn't reference their types directly.

To fix I have:

  • Add Swashbuckle.AspNetCore as a direct dependency in the umbraco-extension project template
  • Updated Swashbuckle.AspNetCore from 10.1.0 to 10.1.4 across the solution and template (just to make sure we on't miss this when Dependencies: Update server-side dependencies to latest patch or minor releases #21860 is merged.
  • Added a cross-reference comment to Directory.Packages.props so the two versions are kept in sync when Swashbuckle is updated in the future.

Testing

See the linked issue. Though as it will involve building and creating from the templates, I think visual inspection will suffice here.

Copilot AI review requested due to automatic review settings February 23, 2026 11:50
Copy link
Copy Markdown
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 PR fixes a runtime issue where extension templates could fail to register custom Swagger documents due to version conflicts in transitive dependencies. The fix adds a direct dependency on Swashbuckle.AspNetCore to the extension template and updates the package version from 10.1.0 to 10.1.4 across the solution.

Changes:

  • Added direct Swashbuckle.AspNetCore dependency to the extension template with detailed explanatory comment
  • Updated Swashbuckle.AspNetCore from 10.1.0 to 10.1.4 in Directory.Packages.props
  • Added cross-reference comment to help maintainers keep versions synchronized

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
templates/UmbracoExtension/Umbraco.Extension.csproj Adds direct Swashbuckle dependency with comprehensive comment explaining why it's needed to prevent version conflicts
Directory.Packages.props Updates Swashbuckle version to 10.1.4 and adds comment to keep template version in sync

…o-extension-template

# Conflicts:
#	Directory.Packages.props
Copy link
Copy Markdown
Contributor

@nikolajlauridsen nikolajlauridsen left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@nikolajlauridsen nikolajlauridsen enabled auto-merge (squash) March 10, 2026 09:50
@nikolajlauridsen nikolajlauridsen merged commit dbc0b43 into main Mar 10, 2026
27 checks passed
@nikolajlauridsen nikolajlauridsen deleted the v17/bugfix/21864-add-swashbuckle-reference-to-extension-template branch March 10, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants