Skip to content
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

Amounts should be BigDecimals #15

Open
PavelNiedoba opened this issue May 24, 2024 · 1 comment
Open

Amounts should be BigDecimals #15

PavelNiedoba opened this issue May 24, 2024 · 1 comment

Comments

@PavelNiedoba
Copy link

PavelNiedoba commented May 24, 2024

I believe that all amounts should be BigDecimals, but there's just strings in generated code:

`
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class AmountInfo {
public static final String JSON_PROPERTY_AMOUNT = "amount";
private String amount;

public static final String JSON_PROPERTY_REQUESTED_AMOUNT = "requestedAmount";
private String requestedAmount;

public static final String JSON_PROPERTY_NET_AMOUNT = "netAmount";
private String netAmount;

public static final String JSON_PROPERTY_AMOUNT_U_S_D = "amountUSD";
private String amountUSD;

public AmountInfo() {}

public AmountInfo amount(String amount) {
    this.amount = amount;
    return this;
}
...

`

The problem seems to in OpenApi yaml, so might be easy fix but it's breaking change

 AmountInfo:
      description: The details of the requested amount to transfer.
      example:
        amount: amount
        amountUSD: amountUSD
        netAmount: netAmount
        requestedAmount: requestedAmount
      properties:
        amount:
          description: "If the transfer is a withdrawal from an exchange, the actual\
            \ amount that was requested to be transferred. Otherwise, the requested\
            \ amount."
          type: string
        requestedAmount:
          description: The amount requested by the user.
          type: string
        netAmount:
          description: "The net amount of the transaction, after fee deduction."
          type: string
        amountUSD:
          description: The USD value of the requested amount.
          type: string
      type: object

@SlavaSereb
Copy link

SlavaSereb commented Jun 3, 2024

Hey @PavelNiedoba, the openAPI spec is correct and the actual types of the amounts returned by the API are strings.
We use this in order to avoid some possible rounding issues when converting decimals...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants