SMILEY4 / ktor-swagger-ui

Kotlin Ktor plugin to generate OpenAPI and provide Swagger UI
Apache License 2.0
156 stars 25 forks source link

Extract openapi contract during compilation #40

Closed chameleon82 closed 1 year ago

chameleon82 commented 1 year ago

DSL allow to expose OpenAPI contract when application is being executed following "code first" approach.

However, I would like to build pipelines based on source code where "contract first" approach quite well, but in DSL case I don't have contract available.

One of scenarios I may want to implement is to create gradle task to extract openapi.json file into local file and run pipelines against that file (for example, can trigger vaildation and publish new openapi contract as artifact if only changes in contract detected).

Is there any way to achieve it?

PS: as one of improvements in that direction it is possible to create ktor-swagger-ui-gradle-plugin to extract openapi spec from ktor project/module and place it into resources folder during compilation instead of doing it in runtime. It will allow to avoid having extra dependencies in runtime.

SMILEY4 commented 1 year ago

sry, this plugin was not originally built to support generation when at "compile-time" and i don't think i have the time to implement this functionality