chi URLFormat middleware breaks OpenAPI autodocs
This is more of a callout for something in the Huma docs, not a bug report, but reporting it here because it took me a while to track down what was causing the issue :)
If you use the URLFormat chi middleware in your router stack, this middleware will break Huma's OpenAPI docs/ endpoint generation.
The /docs site will display the following:
The API description document could not be fetched. This could indicate connectivity problems, or issues with the server hosting the spec.
after looking at the URLFormat middleware and the implementation of the Huma docs/ endpoint, it totally makes sense why these two things don't mix with each other. The URLFormat middleware rewrites URLs that end in .json or .xml and the openapi.yaml files that the autodocs site uses get rewritten and thus end up 404'ing, which is evident in the log files:
2025/05/31 09:31:06 [megabox/SjC3eHV85g-000001] "GET http://localhost:3333/openapi.yaml HTTP/1.1" from [::1]:44928 - 404 19B in 199.171us
Anyway, thought it was worth submitting an issue so potentially you can add it to your doc site or some other future coder can find this issue and save some time!
BTW, thanks for Huma! It's an awesome microframework. Really enjoying using it.