Skip to content

[Kotlin][Client] Fix url path for Retrofit, Fix optionals for @Query @Body, Set List as default collection for Kotlin data class #6456

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

Merged

Conversation

kuFEAR
Copy link
Contributor

@kuFEAR kuFEAR commented May 27, 2020

I got some fixes from PR #5697

  1. Fix url path for Retrofit
  2. Fix optionals for @query @Body in requests
  3. Set List as default collection for Kotlin data class, because data classes require override hashCode and equals methods
  4. Small template formatting improvement

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
    @4brunu @wing328 @ch4rl3x

@kuFEAR kuFEAR changed the title [Kotlin][Client] Fix url path for Retrofit, Fix optionals for @Query, Replace Array with ArrayList for Kotlin Data Class [Kotlin][Client] Fix url path for Retrofit, Fix optionals for @Query @Body, Replace Array with ArrayList for Kotlin Data Class May 27, 2020
@kuFEAR kuFEAR changed the title [Kotlin][Client] Fix url path for Retrofit, Fix optionals for @Query @Body, Replace Array with ArrayList for Kotlin Data Class [Kotlin][Client] Fix url path for Retrofit, Fix optionals for @Query @Body, Set List as default collection for Kotlin data class May 27, 2020
@4brunu
Copy link
Contributor

4brunu commented May 28, 2020

Can you please fix those tests?

e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (25, 33): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (27, 28): Type inference failed. Expected type mismatch: inferred type is Array<Tag> but List<Tag>? was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (47, 47): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (55, 48): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (66, 33): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/StoreApiTest.kt: (21, 29): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected

The PR is very big, because it changes a lot of things in the sample projects.
But it looks good.

@kuFEAR
Copy link
Contributor Author

kuFEAR commented May 28, 2020

Can you please fix those tests?

e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (25, 33): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (27, 28): Type inference failed. Expected type mismatch: inferred type is Array<Tag> but List<Tag>? was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (47, 47): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (55, 48): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/PetApiTest.kt: (66, 33): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected
e: /root/src/github.com/OpenAPITools/openapi-generator/samples/client/petstore/kotlin/src/test/kotlin/org/openapitools/client/StoreApiTest.kt: (21, 29): Type inference failed. Expected type mismatch: inferred type is Array<String> but List<String> was expected

The PR is very big, because it changes a lot of things in the sample projects.
But it looks good.

ff3f63d but when I run test locally it failed with com.squareup.moshi.LinkedHashTreeMap cannot be cast to org.openapitools.client.models.Pet

@kuFEAR
Copy link
Contributor Author

kuFEAR commented May 28, 2020

The PR is very big

yeah, every time when changed some basic template we should update all kotlin-* scripts)

kuFEAR added 3 commits June 5, 2020 10:29
…fix_list_and_fix_retrofit_path

# Conflicts:
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-multiplatform/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-multiplatform/src/commonMain/kotlin/org/openapitools/client/apis/FakeApi.kt
#	samples/openapi3/client/petstore/kotlin/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
…fix_list_and_fix_retrofit_path

# Conflicts:
#	samples/client/petstore/kotlin-jackson/src/main/kotlin/org/openapitools/client/models/Pet.kt
@kuFEAR
Copy link
Contributor Author

kuFEAR commented Jun 10, 2020

@wing328 Are you planning to merge #6585 and this PR into 5.0.0?

kuFEAR added 6 commits June 11, 2020 19:03
…fix_list_and_fix_retrofit_path

# Conflicts:
#	samples/client/petstore/kotlin-retrofit2/docs/PetApi.md
#	samples/client/petstore/kotlin-retrofit2/docs/UserApi.md
#	samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
#	samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
#	samples/client/petstore/kotlin-retrofit2/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/PetApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/docs/UserApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-coroutines/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/PetApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/docs/UserApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/FakeApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/PetApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/docs/UserApi.md
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/AnotherFakeApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/FakeClassnameTags123Api.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
#	samples/openapi3/client/petstore/kotlin-jvm-retrofit2-rx2/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
@kuFEAR
Copy link
Contributor Author

kuFEAR commented Jun 13, 2020

after merging ccb5ae7 when I ran generate-samples.sh for kotlin* I don't have changes as on circleCI like:

-@Api(value = "Pet", description = "The Pet API")
+@Api(value = "pet", description = "The pet API")

on my branch it still generate with as "Pet"
@4brunu @wing328 any idea how to fix it?

@wing328
Copy link
Member

wing328 commented Jun 14, 2020

CC @jimschubert (2017/09) ❤️, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03)

@wing328
Copy link
Member

wing328 commented Jun 14, 2020

I've merged the latest master and update the Kotlin samples. Let's see how it goes.

@kuFEAR
Copy link
Contributor Author

kuFEAR commented Jun 14, 2020

I've merged the latest master and update the Kotlin samples. Let's see how it goes.

now I saw https://app.circleci.com/pipelines/github/OpenAPITools/openapi-generator/3497/workflows/345773ae-ab74-4162-a8c5-1592ae010e4f/jobs/16865/parallel-runs/2?filterBy=FAILED there a lot not related with kotlin uncommited changes, go/apex/java-google-api

@wing328
Copy link
Member

wing328 commented Jun 14, 2020

Not sure how but some of your changes update apex, go, etc petstore samples. I've pushed another update by updating all samples. Let's see how it goes.

@wing328
Copy link
Member

wing328 commented Jun 15, 2020

If no further question/feedback on this PR, I'll merge it tomorrow (Tuesday)

@wing328 wing328 merged commit 53eff43 into OpenAPITools:master Jun 16, 2020
@wing328 wing328 added this to the 5.0.0 milestone Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants