Skip to content

fix: Swagger not working when static files weren't served at /static/#383

Merged
seqre merged 1 commit into
masterfrom
fix-swagger-static
Jul 22, 2025
Merged

fix: Swagger not working when static files weren't served at /static/#383
seqre merged 1 commit into
masterfrom
fix-swagger-static

Conversation

@m4tx

@m4tx m4tx commented Jul 21, 2025

Copy link
Copy Markdown
Member

No description provided.

@m4tx m4tx requested a review from seqre July 21, 2025 21:27
@github-actions github-actions Bot added the C-lib Crate: cot (main library crate) label Jul 21, 2025
@codecov

codecov Bot commented Jul 21, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cot/src/openapi/swagger_ui.rs 95.00% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
rust 89.74% <95.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
cot/src/openapi/swagger_ui.rs 80.95% <95.00%> (+4.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seqre seqre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did you have to include OnceLock?

@m4tx

m4tx commented Jul 22, 2025

Copy link
Copy Markdown
Member Author

Why did you have to include OnceLock?

We don't know the URLs of the static files until the first request. We need to set them in the SwaggerUi object (to a &mut reference), so we need either a OnceLock, a Mutex, or some other mechanism that allows us to mutate the object after it was created.

@seqre seqre merged commit 18130c1 into master Jul 22, 2025
36 checks passed
@seqre seqre deleted the fix-swagger-static branch July 22, 2025 18:25
@cotbot cotbot Bot mentioned this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-lib Crate: cot (main library crate)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants