Skip to content

Fix expand/collapse feature with many apis#40

Merged
teociaps merged 4 commits intomainfrom
fix/expand-collapse-with-many-apis
Feb 5, 2026
Merged

Fix expand/collapse feature with many apis#40
teociaps merged 4 commits intomainfrom
fix/expand-collapse-with-many-apis

Conversation

@teociaps
Copy link
Owner

This pull request introduces several updates focused on improving advanced UI features for Swagger UI theme demos, cleaning up sample code and assets, and enhancing the robustness of UI scripts. The most significant changes include enabling advanced UI features by default in sample apps, removing unused custom theme files, and refactoring JavaScript logic for better reliability and maintainability.

Sample Application Enhancements:

  • Enabled all advanced Swagger UI features by default in both Sample.AspNetCore.SwaggerUI.NSwag and Sample.AspNetCore.SwaggerUI.Swashbuckle sample apps, making demos more interactive and easier to showcase. [1] [2]
  • Commented out the basic "Dark Theme" usage in both sample Program.cs files to emphasize the advanced features demos. [1] [2]

Cleanup of Custom Theme Assets:

  • Removed unused custom theme classes (CustomTheme, CustomMinifiedStyle) and the sample custom CSS file (custom.css) from both sample projects, simplifying the codebase and eliminating dead code. [1] [2]

JavaScript UI Improvements:

  • Refactored the expand/collapse operations button logic in ui.js to be more robust: added retry logic for dynamic rendering, prevented duplicate buttons, and ensured compatibility with incremental UI updates.
  • Improved theme switcher logic in ui.js: fixed edge cases for theme detection, enhanced stylesheet matching, and moved the theme detection function for better code organization. [1] [2] [3] [4] [5]

- Refactored "Expand/Collapse All" logic to support dynamic Swagger UI content using retries and MutationObserver.
- Prevented duplicate expand/collapse buttons with data attributes.
- Updated minified file to reflect all changes.
@teociaps teociaps self-assigned this Jan 15, 2026
@teociaps teociaps added bug Something isn't working completed The feature or bug fix is completed and needs to be published labels Jan 15, 2026
@teociaps teociaps marked this pull request as ready for review February 3, 2026 18:59
@teociaps teociaps merged commit 036b51a into main Feb 5, 2026
@teociaps teociaps deleted the fix/expand-collapse-with-many-apis branch February 5, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working completed The feature or bug fix is completed and needs to be published

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant