Skip to content

fix(ktor-client): do not add jsonBlock if using kotlinx-serialization#15793

Merged
wing328 merged 7 commits intoOpenAPITools:masterfrom
bcmedeiros:fix-ktor-kotlinx-serialization
Jun 11, 2023
Merged

fix(ktor-client): do not add jsonBlock if using kotlinx-serialization#15793
wing328 merged 7 commits intoOpenAPITools:masterfrom
bcmedeiros:fix-ktor-kotlinx-serialization

Conversation

@bcmedeiros
Copy link
Copy Markdown
Contributor

@bcmedeiros bcmedeiros commented Jun 8, 2023

Fix for #15794

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    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.
  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date
    
    Commit all changed files.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@bcmedeiros
Copy link
Copy Markdown
Contributor Author

@bcmedeiros
Copy link
Copy Markdown
Contributor Author

Error seems totally unrelated and I'm unable to reproduce locally. Is this a flaky testing failing just in CI?

@stefankoppier
Copy link
Copy Markdown
Contributor

stefankoppier commented Jun 8, 2023

Error seems totally unrelated and I'm unable to reproduce locally. Is this a flaky testing failing just in CI?

Hi, thanks for the PR. It seems that a sample is changed but not pushed. Did you merge master and generate all samples? If not, please try that. Edit: I'm on my phone, so I can't review property right now. But did you add the new sample to the list in https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-kotlin-client.yaml?

@bcmedeiros bcmedeiros requested a review from jimschubert as a code owner June 8, 2023 23:23
…t.yaml pipeline

actually, kotlin-jvm-ktor-gson was duplicated, so I'm replacing the second one by kotlin-jvm-ktor-kotlinx_serialization
@bcmedeiros bcmedeiros force-pushed the fix-ktor-kotlinx-serialization branch from 4301831 to 51dfcb2 Compare June 8, 2023 23:36
@bcmedeiros
Copy link
Copy Markdown
Contributor Author

@stefankoppier tahnks for pointing that out, I was indeed missing the pipeline file. I'm not sure how that was causing the test error, but it seems to be gone now.

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jun 9, 2023

@bcmedeiros
Copy link
Copy Markdown
Contributor Author

@stefankoppier @wing328 sorry for the back and forth, both errors should be fixed now, I'm getting the gist of the way the project is organized.
Just as a heads-up, I found another issue with ktor + kotlinx-serialization, in regards to not setting the content type, I'll submit another issue/PR as soon as this one gets sorted.

@wing328 wing328 added this to the 7.0.0 milestone Jun 11, 2023
generatorName: kotlin
outputDir: samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization
library: jvm-ktor
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use 3.0 spec instead

modules/openapi-generator/src/test/resources/3_0/petstore.yaml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use 3.0 spec instead

I was using 2.0 because all the other kotlin/ktor were using it, but sure, I can update this one.

Just as a heads-up, I found another issue with ktor + kotlinx-serialization, in regards to not setting the content type, I'll submit another issue/PR as soon as this one gets sorted.

Also, since we are doing changes that are not related strictly to jsonBlock anymore, should I add the other fixes I have to this same PR, or do you still prefer that I raise another issue/ticket?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using 2.0 because all the other kotlin/ktor were using it, but sure, I can update this one.

yes, i know what you're talking about. we know yet have time to update those to use 3.0 spec.

for new one (test), we definitely want to start with 3.0 spec

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, since we are doing changes that are not related strictly to jsonBlock anymore, should I add the other fixes I have to this same PR, or do you still prefer that I raise another issue/ticket?

We prefer small PRs for easier review.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll raise another PR right after.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also worth sharing with you that we are gradually moving away from petstore and will switch to echo server instead for client testings. https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests#echo-server has more info.

(no need to do anything in this PR. more of an FYI)

@bcmedeiros
Copy link
Copy Markdown
Contributor Author

@wing328 changes pushed. Also made a comment above, let me know how you want me to proceed.

@bcmedeiros
Copy link
Copy Markdown
Contributor Author

@wing328 FYI all tests passed.

@wing328 wing328 merged commit ca80fcd into OpenAPITools:master Jun 11, 2023
@wing328
Copy link
Copy Markdown
Member

wing328 commented Jun 11, 2023

Merged. Thanks for the contribution.

amakrushin pushed a commit to amakrushin/openapi-generator that referenced this pull request Jun 12, 2023
…OpenAPITools#15793)

* fix(ktor-client): do not add jsonBlock if using kotlinx-serialization

* update existing templates

* add new kotlin-jvm-ktor-kotlinx_serialization

* add new kotlin-jvm-ktor-kotlinx_serialization to samples-kotlin-client.yaml pipeline

actually, kotlin-jvm-ktor-gson was duplicated, so I'm replacing the second one by kotlin-jvm-ktor-kotlinx_serialization

* extra FILES entry in the template

* enumUnknownDefaultCase=false for now since it's currently broken for ktor + kotlinx_serialization

* use openapi 3 petstore
fmoraespadtec pushed a commit to padteclab/openapi-generator that referenced this pull request Jun 26, 2023
…OpenAPITools#15793)

* fix(ktor-client): do not add jsonBlock if using kotlinx-serialization

* update existing templates

* add new kotlin-jvm-ktor-kotlinx_serialization

* add new kotlin-jvm-ktor-kotlinx_serialization to samples-kotlin-client.yaml pipeline

actually, kotlin-jvm-ktor-gson was duplicated, so I'm replacing the second one by kotlin-jvm-ktor-kotlinx_serialization

* extra FILES entry in the template

* enumUnknownDefaultCase=false for now since it's currently broken for ktor + kotlinx_serialization

* use openapi 3 petstore
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