mirror of
https://github.com/axllent/mailpit.git
synced 2026-04-26 08:45:54 +03:00
[GH-ISSUE #442] Swagger JSON Causes Stack Overflow #285
Labels
No labels
awaiting feedback
bug
docker
documentation
enhancement
github_actions
invalid
pull-request
question
stale
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/mailpit#285
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @melloware on GitHub (Feb 13, 2025).
Original GitHub issue: https://github.com/axllent/mailpit/issues/442
Verified with 1.22.0 and 1.22.2 with two different tools it causes Stack Overflow.
Test it for yourself here online with Kubb: https://kubb.dev/playground
works with 1.21.8: https://raw.githubusercontent.com/axllent/mailpit/refs/tags/v1.21.8/server/ui/api/v1/swagger.json
Fails with 1.22.0: https://raw.githubusercontent.com/axllent/mailpit/refs/tags/v1.22.0/server/ui/api/v1/swagger.json
See also OpenAPI Genertor: https://github.com/OpenAPITools/openapi-generator/issues/20607
@melloware commented on GitHub (Feb 13, 2025):
I feel like the infinite loop is here:
Triggers refs itself?
EDIT: if I remove the last
"$ref": "#/definitions/Triggers"i can now build using both Kubb and OpenApiGenerator.@carolosf commented on GitHub (Feb 13, 2025):
Oddly this test didn't detect a problem:
https://github.com/axllent/mailpit/actions/runs/13219308646/job/36902383782#step:10:21
@carolosf commented on GitHub (Feb 13, 2025):
Installing go swagger from here on darwin arm64:
https://github.com/go-swagger/go-swagger/releases/tag/v0.31.0
Also says its valid
Tried to generate it with the following but doesn't produce the same swagger.json file
@axllent please also document how to generate the swagger file / let us know in this issue
@axllent commented on GitHub (Feb 14, 2025):
This is interesting, please bear with me...
I use the official https://editor.swagger.io/ confirm the swagger.json to validate the generated swagger file is valid (which it does), so this was not picked up as broken. I do however confirm that kubb (I've never used it before) breaks.
Personally I do not use swagger directly, however I do use it to document the API. To make my life a lot easier, I use a tool (go-swagger) to convert structured inline Go comments to swagger. I've often had to spend far more time than I like to admit trying to get the darn thing to work (structured correctly), but it's about the only metric I have to know if it's working and making sense, so I'm glad you reported this.
The downloadable releases of go-swagger are however a bit temperamental (I've had very mixed results), so I built a docker image with a working version of go-swagger which I use to generate the config (this at least gives me consistent results):
With hind sight I would have used a different tool from the beginning, however it's difficult to backtrack on all that work, not to mention the potential for breakage if I do, so we are where we are.
Anyway, with the information you have provided, I was able to identify where (not exactly why) the issue was coming from, and have just pushed an update which now validates on both tools. Could you please confirm for me that https://raw.githubusercontent.com/axllent/mailpit/refs/heads/develop/server/ui/api/v1/swagger.json works for you?
Thank you.
@carolosf commented on GitHub (Feb 14, 2025):
Thanks for the quick response and how to generate the swagger file!
It does seem to be working for quarkus-mailpit now thanks!
I've made this pull request - builds for me locally and in the PR build:
https://github.com/quarkiverse/quarkus-mailpit/pull/117
Have a great day
@axllent commented on GitHub (Feb 14, 2025):
Awesome. I'll release a new tagged version this weekend, so probably wisest you stick with those in case you end up with non-released features in the future.
@melloware commented on GitHub (Feb 14, 2025):
@axllent many thanks for your quick fix and attention to this!
@axllent commented on GitHub (Feb 15, 2025):
This fix has now been released in v1.22.3. As I mentioned before, I would strongly suggest against linking to the develop branch as that contains often unreleased changes. If you want to always link to the latest released version, then use
https://raw.githubusercontent.com/axllent/mailpit/refs/heads/master/server/ui/api/v1/swagger.json(ie:masterbranch).Thanks for reporting the issue!
@melloware commented on GitHub (Feb 16, 2025):
Thank you!