hey guys, why is open api generator available for ...
# ktor
f
hey guys, why is open api generator available for embedded server type of app but not when configured by hocon, it’s not even available when the caret is over module function too, how do we generate open api for this use case?
a
I would recommend you to look at Tegral OpenApi, it generates the spec directly from your routes at runtime, instead of by inspecting them beforehand
🙏 1
f
@Alejandro Serrano Mena thank you, I'll look into that, do you know if the exported open api or swagger paths can be protected with auth?
b
I can also recommend ktor-swagger-ui it gives you a lot of flexibility by writing the documentation directly in code. It will never get outdated
🙏 1
a
To generate OpenAPI specification run the
Generate OpenAPI documentation for Ktor in Module: …
action.
f
@Aleksei Tirman [JB] it generates incorrect documentation, doesn’t capture all the routes, example my tag routes aren’t even detected, although the TagModel is detected, but not all of my response models are detected
r
Yeah it's pretty bad right now, basically useless. But it's brand new! Also it doesn't even run https://youtrack.jetbrains.com/issue/KTOR-5308
😢 1
a
@FunkyMuse yes, afaik there’re just regular routes, so you can use authentication if needed
🙏 1
a
@Alejandro Serrano Mena if you are talking about the
swaggerUI
method then no. See https://kotlinlang.slack.com/archives/C0A974TJ9/p1670490068605649
a
I meant the Tegral one
a
Ah, ok