Skip to content

[BUG][Kotlin] Generated Serializer for ApiClient does not support BigDecimal #7196

@nilskuhn

Description

@nilskuhn

Description

Generating a Kotlin client for an API that uses BigDecimal in the model, the generated ApiClient doesn't work because the generated Moshi serializer does not have a type adapter for BigDecimal. Unfortunately, there is no way to inject the type adapter yourself.

openapi-generator version

4.3.1

Steps to reproduce

Any API with BigDecimal should demonstrate the problem. Generate Kotlin API and try to send message. I get exception:

java.lang.IllegalArgumentException: Platform class java.math.BigDecimal (with no annotations) requires explicit JsonAdapter to be registered
	at com.squareup.moshi.ClassJsonAdapter$1.create(ClassJsonAdapter.java:60) ~[moshi-1.8.0.jar:na]
	at com.squareup.moshi.Moshi.adapter(Moshi.java:137) ~[moshi-1.8.0.jar:na]

Suggest a fix

Add BigDecimal adapter here: com.kn.containerDashboard.backend.client.rgs.infrastructure.Serializer

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions