Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !13728

[BUG][Kotlin/okhttp-gson] wrong handling of empty response #13718

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/zoltanwork/BUG-13718-Kotlin-wrong_handling_of_empty_response into master Oct 18, 2022
  • Overview 2
  • Commits 3
  • Pipelines 1
  • Changes 1

Created by: zoltanwork

We use a legacy REST server that returns a non-empty response even if it the response type is Unit. In this case the following exception is thrown: java.lang.IllegalArgumentException: Platform class kotlin.Unit requires explicit JsonAdapter to be registered at com.squareup.moshi.ClassJsonAdapter$1.create(ClassJsonAdapter.java:76) at com.squareup.moshi.Moshi.adapter(Moshi.java:146) at com.squareup.moshi.Moshi.adapter(Moshi.java:106) at com.squareup.moshi.Moshi.adapter(Moshi.java:75) at com.squareup.moshi._MoshiKotlinExtensionsKt.adapter(-MoshiKotlinExtensions.kt:40) ...

I checked another generator (Java/apache-httpclient) to see how it handles this case. There the Java class of the expected result is checked and the code doesn't call the JSON deserializer if no response is expected.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/zoltanwork/BUG-13718-Kotlin-wrong_handling_of_empty_response