-
-
Notifications
You must be signed in to change notification settings - Fork 1
Migration v2
teociaps edited this page Nov 27, 2025
·
2 revisions
This guide helps you migrate from SwaggerUI.Themes v1.x to v2.0.
What Changed:
The NoJsModernStyle class has been deprecated and removed. Its functionality has been merged into ModernStyle.
Why:
- Simplified API - one less class to remember
- More flexible - features are opt-in via advanced options
- Better defaults - JavaScript features disabled by default
// ❌ Before (v1.x)
app.UseSwaggerUI(NoJsModernStyle.Dark);
// ✅ After (v2.0)
app.UseSwaggerUI(ModernStyle.Dark);If you want JavaScript features, enable them explicitly:
// ✅ v2.0 - Enable features as needed
app.UseSwaggerUI(ModernStyle.Dark, options =>
{
options.EnablePinnableTopbar();
options.ShowBackToTopButton();
options.EnableStickyOperations();
options.EnableExpandOrCollapseAllOperations();
// Or enable all at once:
// options.EnableAllAdvancedOptions();
});| Class | v1.x Behavior | v2.0 Behavior |
|---|---|---|
ModernStyle |
✅ JavaScript enabled | ❌ JavaScript disabled (opt-in) |
NoJsModernStyle |
❌ JavaScript disabled | ⛔ Removed - use ModernStyle
|
Note
In v2.0, ModernStyle defaults to no JavaScript unless you explicitly enable features.
- Find all uses of
NoJsModernStyle - Replace with
ModernStyle - If you need JavaScript features, enable them via options
- Test your application
- Verify themes render correctly
using AspNetCore.Swagger.Themes;
// Without JavaScript
app.UseSwaggerUI(NoJsModernStyle.Dark);
// With JavaScript
app.UseSwaggerUI(ModernStyle.Dark);using AspNetCore.Swagger.Themes;
// Without JavaScript (same as v1.x NoJsModernStyle)
app.UseSwaggerUI(ModernStyle.Dark);
// With JavaScript (explicitly enabled)
app.UseSwaggerUI(ModernStyle.Dark, options =>
{
options.EnableAllAdvancedOptions();
});- Check the Getting Started guide
- Open an issue on GitHub
- Review the Advanced Options documentation
If you're migrating from v1.x directly to v3.0, you'll also need to apply the v3.0 changes:
The v3.0 changes include:
-
ModernStyle→Themerename - Additional new features
Migration complete! Your application is now running v2.0. ✅
🚀 Getting Started
✨ Features
📖 Migration Guides