Templates: Add direct Swashbuckle dependency to extension template (closes #21864)#21869
Merged
nikolajlauridsen merged 2 commits intomainfrom Mar 10, 2026
Conversation
Contributor
There was a problem hiding this comment.
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.AspNetCoredependency to the extension template with detailed explanatory comment - Updated
Swashbuckle.AspNetCorefrom 10.1.0 to 10.1.4 inDirectory.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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.AspNetCoredependency to the latest version; but the problem could recur.The problem occurs because the extension template code directly uses types from
Swashbuckle.AspNetCore(SwaggerGenOptions) andMicrosoft.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.OpenApiversions (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:
Swashbuckle.AspNetCoreas a direct dependency in theumbraco-extensionproject templateSwashbuckle.AspNetCorefrom 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.Directory.Packages.propsso 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.