Skip to content
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

Utoipa-swagger-ui seems to be linking in Swagger UI to the build by default #1051

Open
kanpov opened this issue Sep 16, 2024 · 5 comments
Open

Comments

@kanpov
Copy link

kanpov commented Sep 16, 2024

Version of utoipa-swagger-ui: 7.1.1-beta.0

Vendored feature is not enabled, including the package increases the release binary by ~12MB. Is this intended behavior?

@juhaku
Copy link
Owner

juhaku commented Sep 16, 2024

I guess it would be reasonable to investigate what gets included to the release binary. Yet no matter of using vendored feature flag or not the Swagger UI files will anyways be included to the final binary. Vendored will just use prepackaged Swagger UI. Without vendoring the Swagger UI will be downloaded build time and embedded to the binary.

It just might be that the Swagger UI is that big. It actually contains a bunch of files. If want something more lightweight you should try scalar or rapidoc or redoc (redoc does not allow executing those paths from the UI).

@kanpov
Copy link
Author

kanpov commented Sep 17, 2024

I think it'd be reasonable to add a PSA about binary size to the doc page of utoipa-swagger-ui. I might give you exact figures on the binary size increase (but the ~12-13MB increase approximation is pretty accurate for my own project) later with an empty project.

@JMLX42
Copy link
Contributor

JMLX42 commented Oct 10, 2024

Uncompressed, Swagger UI is ~17MB. Compressed, it's ~4.5MB. So I guess something like UPX should do the job on the final binary.

But UPX does not work on my specific binary...

Update: my local build was linked with mold. Without mold, upx runs as expected and shrinks the binary by up to 75%. The compression is most likely very efficient on the Swagger UI assets.

@juhaku
Copy link
Owner

juhaku commented Oct 15, 2024

Sure, we could add heads up notification to README.md of utoipa-swagger-ui crate to inform potential users that Swagger UI needs some space.

@JMLX42
Copy link
Contributor

JMLX42 commented Nov 3, 2024

Sure, we could add heads up notification to README.md of utoipa-swagger-ui crate to inform potential users that Swagger UI needs some space.

Or we could compress the Swagger UI assets in the binary. There are some crates to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants