Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Ktor 2.0.0 #128

Open
Marek00Malik opened this issue Apr 14, 2022 · 13 comments
Open

Support for Ktor 2.0.0 #128

Marek00Malik opened this issue Apr 14, 2022 · 13 comments

Comments

@Marek00Malik
Copy link

Hey,
When can we count on support for the new Ktor release -> 2.0.0 ?
I'm not able to install the OpenAPIGen plugin.

@vladtrc
Copy link

vladtrc commented Apr 14, 2022

In my opinion such functionality should already be built in...

@Wicpar
Copy link
Collaborator

Wicpar commented Apr 14, 2022

i don't work with Ktor anymore, i can't spare the time for such a rework, however i will accept pull requests...

@LukasForst
Copy link

LukasForst commented Apr 15, 2022

Hey, I forked this repo and wired stuff together to work with Ktor 2.0.0 the fork is here - https://github.com/LukasForst/ktor-openapi-generator - it's also deployed on maven central, so feel free to use that build.

It's not very nice, Ktor removed some stuff this lib relied on (content type handling for example see this ugly hack ) but I monkey patched most of the stuff and now I'm successfully using that in two of my projects in production with Ktor 2.0.0 - so I guess the subset of stuff I use works.

There're are definitelly better ways how to fix all that stuff to make it compatible with Ktor 2.0.0, I choose the way of minimal effort and that's why I didn't make PR to this repository. I'm not sure if we can upstream this to master here as during the process I also migrated to gradle kotlin DSL and I'm not sure what plans does @Wicpar have with this project.

@Wicpar
Copy link
Collaborator

Wicpar commented Apr 15, 2022

@LukasForst if you are willing to maintain the project i can add you as a collaborator, and it would be a good idea to update to the newer version, even if it's a bit hacky

@Marek00Malik
Copy link
Author

Hey @LukasForst I'm trying out your fork actually now. The sad part is that there is no support for Location API which looks like the way Ktor is heading (I saw an issue even raised, but it got closed... #70). Are you @LukasForst planning to play with it? I know there is a repo called kompendium that is supporting it, but they are not on Ktor 2.0.0 yet.

@sigmanil
Copy link

sigmanil commented Apr 26, 2022

@LukasForst Are you using StatusPages in your applications with your fork? I'm trying out your fork and I seem to have some trouble with statuspages (exception handling) in tests. It's a bit weird, the tests have gone unstable, the status pages set up using the OpenApiGen withApi syntax seem to trigger only sometimes.

Edit: There's definately something strange happening with the StatusPages in the LukasForst fork, I removed the OpenApiGen status pages and relied only on base Ktor StatusPages for 2.0.0, and now it works.

@LukasForst
Copy link

LukasForst commented May 4, 2022

hey @sigmanil can you try to update to latest Ktor 2.0.1? See https://youtrack.jetbrains.com/issue/KTOR-4187 because that was for example problem in my apps

actually, I'm surprised base ktor status pages work for you in 2.0.0 because according to that Ktor bug, it was broken (and it was broken in my services as well)

anyway, I'm going to release version with Ktor 2.0.1, let us know if that fixes the behavior of status pages in this library or not LukasForst#2

@LukasForst
Copy link

LukasForst commented May 4, 2022

@Wicpar I'd like to, but definitely not now (busy on other projects, maybe during summer? I'll let you know). However, there're some rumours that JetBrains will work on Ktor Swagger as well (the issue has moved to "in progress" and see blog ) so maybe we will get native support. That would definitely be nice.

@LukasForst
Copy link

@Marek00Malik sorry, but right now, I don't have enough time to work on this, I just ported the basic stuff to keep my own service up and running and it is ugly hack anyway. Maybe I will get some time during summer, but unfortunately I can not guarantee anything.

@LukasForst
Copy link

looks like we're going to get official support after all - https://youtrack.jetbrains.com/issue/KTOR-774 - issue just changed from Open to In Progress

@darkxanter
Copy link
Contributor

It looks like this library is still relevant as JetBrains makes OpenAPI spec generation a paid feature of IDEA Ultimate.

@LukasForst
Copy link

I agree, their solution is far from optimal. I guess we offload serving the UI to their implementation, but honestly even that one is worse, because it fetches js from remote source during runtime...

Anyway, there are now more alternatives in the wild such as https://github.com/bkbnio/kompendium and https://github.com/SMILEY4/ktor-swagger-ui

My fork of this repo is not exactly maintained, but I keep releasing dependency updates to maven central.

@Wicpar
Copy link
Collaborator

Wicpar commented Nov 23, 2022

My fork of this repo is not exactly maintained, but I keep releasing dependency updates to maven central.

well this library isn't either, so if you want i can link to your repo in the readme for 2.0 compat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants