javalin / javalin-openapi

Annotation processor for compile-time OpenAPI & JsonSchema, with out-of-the-box support for Javalin 5.x, Swagger & ReDoc
https://github.com/javalin/javalin-openapi/wiki
Apache License 2.0
45 stars 17 forks source link

[Question] Routes do not appear unless I use @OpenApi annotation? #198

Closed TimonGisler closed 1 year ago

TimonGisler commented 1 year ago

Hi,

In previous versions all the paths specified in Javalin automatically appeared in the swagger Ui. Was this feature removed? Or do I need to do something to activate this feature.

Below a screenshot showcasing what I mean. I have 2 Javalin instances. One (the left one) following the "new" tutorial for Javalin 5 And on the right the "old" tutorial that was linked:

This plugin is also compatible with Javalin 4.x, see: Javalin RFC - OpenApi plugin

image

In the "new" implementation the "test" route does not appear. In the "old" implementation it does.

I also made the project with both the new and old implementation available on github in case you want to take a look yourself.

Thanks in advance. And thanks for creating such an amazing plugin : D.

dzikoysk commented 1 year ago

Hi, yes, this particular feature is not ported from the old OpenApi plugin. The thing is that this plugin does most of the job at compile-time, so it's simply unaware of your runtime configuration (such as e.g. routing). Although it's not possible at compile-time, you can still add some extra data to the scheme using document processor that is invoked at runtime. Something like this: