Skip to content

Make flasgger an optional dependency#65

Merged
kevin1024 merged 1 commit into
mainfrom
flasgger-optional
Jun 16, 2026
Merged

Make flasgger an optional dependency#65
kevin1024 merged 1 commit into
mainfrom
flasgger-optional

Conversation

@kevin1024

Copy link
Copy Markdown

Makes flasgger optional so httpbin can be installed (and packaged) without it. Closes #26.

  • Move flasgger from hard dependencies into the existing mainapp extra. The published Docker image is built with --extra mainapp, so it keeps the Swagger UI homepage with no workflow change.
  • Guard all Swagger setup behind its availability; when flasgger is absent, serve the static legacy landing page at / and log a warning. With flasgger present, behavior is unchanged (/ = Swagger UI, /legacy = static page).
  • Add a subprocess-based regression test that blocks flasgger and asserts / falls back to the static page with a 200 (instead of erroring).

Based on #32 (@AdamWill), with the missing-flasgger warning from #44 (@mgorny), refreshed against main and with a test added. Supersedes both.

flasgger is only needed to render the Swagger UI homepage and /spec.json on
httpbin.org; it's dead weight (and an extra dependency tree, including an
indirect Rust build dep) for the common case of using httpbin as a test
library. It also blocks packaging httpbin for distros that can't ship
flasgger's bundled, pre-minified JS (e.g. Fedora).

Move flasgger from the hard dependencies to the existing "mainapp" extra
(so the published Docker image, built with --extra mainapp, keeps the fancy
homepage) and guard all the Swagger setup behind its availability. When
flasgger is absent, the static legacy landing page is served at / and a
warning is logged.

Adds a subprocess-based regression test that blocks flasgger and asserts /
falls back to the static page with a 200 instead of erroring.

Closes #26. Supersedes #32 and #44.

Co-Authored-By: Adam Williamson <awilliam@redhat.com>
Co-Authored-By: Michał Górny <mgorny@gentoo.org>
@kevin1024 kevin1024 merged commit 0771716 into main Jun 16, 2026
41 of 45 checks passed
@AdamWill

Copy link
Copy Markdown

Thanks!

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

Successfully merging this pull request may close these issues.

Make flasgger optional?

2 participants