-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Upgrade multiplatform libraries #7149
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
Conversation
modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/kotlin-client/libraries/multiplatform/api.mustache
Outdated
Show resolved
Hide resolved
samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt
Outdated
Show resolved
Hide resolved
| ios { | ||
| binaries { | ||
| framework { | ||
| freeCompilerArgs = listOf("-Xobjc-generics") | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't test IOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I basically need someone with a mac who can write a quick unittest for pet store or so and then run the test
|
Technical committee: |
.../openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java
Show resolved
Hide resolved
…ved some minor issues
| ) { | ||
| {{#apiInfo}} | ||
| {{#apis}} | ||
| val {{{classVarName}}} = {{{classFilename}}}(baseUrl, httpClientEngine, jsonConfiguration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may generate the following (invalid) code:
val package = PackageApi(baseUrl, httpClientEngine, jsonConfiguration)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package is a reserved word and should be escaped. Did you perform a test that lead to the invalid example you provided? If so, could you share? I'd like to debug through to understand why package wasn't escaped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can get you an openapi def that reproduces it, but it's rather large
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can put together a minimal doc. I just figured I'd test the same as you if it was handy, but not a big deal if it's cumbersome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the thing:
https://gitlab.com/-/snippets/2007909 (github sadly errors when I try to upload it)
But it's huge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing that's causing it is probably the
"tags": [
"Package"
]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where you able to find the issue that causes it's or should I try crafting a smaller file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a "hacky" solution, for now I just escape everthing. It works fine but it's not quite a best practice
|
cc @jimschubert (2017/09) ❤️, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
|
LGTM |
|
My last review comment (the |
| importMapping.put("OctetByteArray", packageName + ".infrastructure.OctetByteArray"); | ||
|
|
||
| // bundled client file | ||
| supportingFiles.add(new SupportingFile("ApiClient.kt.mustache", baseFolder, "ApiClient.kt")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that renaming ApiClient.kt.mustache to ApiClientBase.kt.mustache is going to cause a lot of problems for anyone who has customized ApiClient.kt.mustache.
Can we find a naming strategy which retains ApiClient.kt.mustache without breaking existing extensions?
If not, we need to mark this PR as a breaking change and provide some guidelines in the PR for how one would migrate from using multiplatform before 5.0 to use it after this PR is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's breaking pretty much, because it used experimental / alpha state libraries (MPP itself is still experimental) and they had a lot of breaking changes themselves, so that not really something you can avoid. I tried to do my best and migrate it to stable versions so there's no deprecated, opt-in or otherwise experimental stuff anymore but it might be incompatible here and there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see what I can do to add a little migration guide or so
|
I left a few comments as inline comments rather than a "review", since they began as replies to existing comments. |
|
I hope I got everything |
@cromefire Did you mean you'd hoped that you had touched each comment? I don't see any additional commits, so I'm confused about whether you were going to push additional work. |
|
Yeah I meant comments because you said you put them there as inline comments and I only found 2 |
|
Upgraded to Kotlin 1.4, Ktor 1.4 and kotlinx.serialization 1.4. That way even more experimental stuff has been replaced with more stable APIs. (So there won't be as many (hopefully none) breaking changes in the future) |
|
Due to large code and structural differences between |
# Conflicts: # samples/client/petstore/kotlin-multiplatform/gradlew.bat
|
CI (travis & circle) seems to have some issues with keyserver.ubuntu.com timing out: Also Shippable is trying to find a pom file in the |
|
Do you want me to do the split here or do you want me to create a 2nd PR for it after this one is merged? If it's fine doing it in this PR is easier and faster for me (for you it might increase the number of lines changed but decrease complexity due to less entangled code) |
|
What I can also do if you want to keep compatibility is I can create a new generator (I've already seen that there are some |
|
I originally thought it might be better to have multiplatform separately for the same reasons… maybe now's the time to do that with the major version coming up. Any thoughts? @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m @OpenAPITools/generator-core-team |
|
Also with the new version is there a timeframe when it has to land or if it's implemented as a "new" one can it land after the version is already released? |
|
I also think it's a good idea to split this into a new generator, since it has more differences that similarities with the jvm kotlin clients. |
|
Based one your feedback (it doesn't seem like anyone wants to oppose splitting this into a new one, although it's also only been 16h) I've decided that I'll probably close this PR on the weekend (if nobody has anything against it until then) and propose a new one, which adds a new client that uses the code from this PR. I'll still be watching feedback you give me here and incorporate it into the new PR. Following that:
|
|
@cromefire I'm glad you asked. We have documentation about how to create a new generator here: https://openapi-generator.tech/docs/new-generator/. While I was finding the link for you, I realized that it hasn't been updated with the new configuration-based approach that we've recently started following (rather than the sample script, it would be a sample config under |
|
@cromefire I've updated the documentation via #7334. By the time you read this, it'll probably be live on the site and the |
|
Replaced by #7353 |
Fixes #5346
PR checklist
./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.master