Skip to content

Add cache headers for ReDoc and SwaggerUI #3341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 30, 2025
Merged

Add cache headers for ReDoc and SwaggerUI #3341

merged 7 commits into from
Mar 30, 2025

Conversation

martincostello
Copy link
Collaborator

  • Embed the versions of redoc and swagger-ui-dist into their respective assemblies as [AssemblyMetdata] attributes.
  • Remove redundant GetTypeInfo() calls.
  • Add cache headers to ReDoc and SwaggerUI static files.

Resolves #3336.

Embed the versions of redoc and swagger-ui-dist into their respective assemblies as `[AssemblyMetdata]` attributes.

Contributes to #3336.
Remove redundant `GetTypeInfo()` calls.
Add cache readers to ReDoc static files.
Add cache readers to SwaggerUI static files.
Use a SHA of the content for the user-configurable assets instead of the ReDoc/SwaggerUI version.
- Allow private cache but not public cache.
- Explicitly set `no-cache, no-store` if no cache value.
Bump version to 8.1.0.
@martincostello martincostello added the version-minor A change suitable for release in a minor version label Mar 30, 2025
@martincostello martincostello added this to the v8.1.0 milestone Mar 30, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 84.37500% with 10 lines in your changes missing coverage. Please review.

Project coverage is 83.28%. Comparing base (37a50bc) to head (6ee97f1).
Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
...rc/Swashbuckle.AspNetCore.ReDoc/ReDocMiddleware.cs 83.33% 5 Missing ⚠️
...buckle.AspNetCore.SwaggerUI/SwaggerUIMiddleware.cs 83.33% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3341      +/-   ##
==========================================
- Coverage   84.56%   83.28%   -1.29%     
==========================================
  Files          84       84              
  Lines        3227     3285      +58     
  Branches      563      567       +4     
==========================================
+ Hits         2729     2736       +7     
- Misses        498      549      +51     
Flag Coverage Δ
Linux 83.28% <84.37%> (+17.43%) ⬆️
Windows 83.28% <84.37%> (+17.43%) ⬆️
macOS 83.28% <84.37%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martincostello martincostello marked this pull request as ready for review March 30, 2025 11:35
@martincostello martincostello merged commit 80f1550 into master Mar 30, 2025
9 checks passed
@martincostello martincostello deleted the gh-3336 branch March 30, 2025 11:35
This was referenced Jul 29, 2025
This was referenced Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
version-minor A change suitable for release in a minor version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request]: Add HTTP cache headers for SwaggerUI static assets
2 participants