OpenAPITools / OpenAPITools/openapi-generator

[BUG] [java] incompatible types: double cannot be converted to java.math.BigDecimal

Open
#4,612 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

hello i'm using version 4.2.1

my json is in the following format

Captura de tela de 2019-11-26 11-29-36

and the generated code looks like this

Captura de tela de 2019-11-26 11-26-18

this was an error at compile time because you can parse it year.

'incompatible types: double cannot be converted to java.math.BigDecimal'

Is there any way around this problem?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the compile-time error with the JSON and generated Java shown in the issue, using version 4.2.1. Trace which generator path produces the incompatible assignment; done means the generated Java compiles without the double-to-BigDecimal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.