Javalin: Multiple Swagger Docs in same Javalin Application

Created on 8 Mar 2020  路  5Comments  路  Source: tipsy/javalin

Describe the feature
I'd like to be able to document multiple different APIs separately in the same Javalin application. I.e. have 3 handlers go to doc A, and have another 3 handlers go to doc B.

Additional context
The purpose of this feature request is API versioning; I'd like to version my API, and have separate docs for each version.

FEATURE REQUEST HELP WANTED OPENAPI

Most helpful comment

Imo, the most intutive to do in this case is to add a sort of tag for every endpoint. Is the tag unset, will the doc be visible in the default swagger, is it set, will the endpoint be visible in /swagger/{tag}.

All 5 comments

Interesting idea. Did you look into this when you were creating the plugin @TobiasWalle?

@A1Liu This use case is indeed very interesting. I didn't though about it yet.

Could you provide an example on how you would like to use a feature like that? Do you have any proposals for a possible api?

@TobiasWalle I'd use it to document different versions of my API.

Also, I think it'd be fine if Javalin added support for nesting Javalin instances on the same threadpool, then we could just attach different endpoints to different Javalin instances and attach docs to those instances.

Imo, the most intutive to do in this case is to add a sort of tag for every endpoint. Is the tag unset, will the doc be visible in the default swagger, is it set, will the endpoint be visible in /swagger/{tag}.

I agree that adding a "tag" (but not an "OpenAPI tag") makes sense. I guess we have one root object now for building the OpenAPI document, but instead we would need a set of such objects? 馃

It doesn't sound too complicated, but that depends a lot on the current implementation, which I'm still not familiar with. I'd be happy to review a PR if someone wants to work on this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tipsy picture tipsy  路  3Comments

ShikaSD picture ShikaSD  路  5Comments

JosefEvAlloc picture JosefEvAlloc  路  5Comments

valtterip picture valtterip  路  5Comments

mkpaz picture mkpaz  路  4Comments