EasyPost / easypost-node

EasyPost Shipping API Client Library for Node
https://easypost.com/docs/api
MIT License
139 stars 54 forks source link

[Bug]: CustomsItem value type doesn't match documented type #447

Closed thattyson closed 7 months ago

thattyson commented 7 months ago

Software Version

7.2.0

Language Version

20.9.0

Operating System

macOS 14.1.2

What happened?

  1. Attempt to add a CustomsItem to CustomsInformation
  2. Build the CustomsItem with all required properties.
  3. Receive an error that the expected type is float for value, rather than a string as is documented.

What was expected?

The package type for value should match the documented type in the API docs.

I would also suggest documenting value more clearly, telling the user if the value should be in dollars or cents. As is, it's unclear unless looking at the example JSON. For other dollar values the documentation shows "USD formatted dollars and cents, delimited by a decimal point". This would clarify.

Documentation

API documentation

Package

  /**
   * Required, greater than zero, total value (unit value * quantity)
   * float (USD)
   */
  value: number;

Sample Code

No response

Relevant logs

No response

Justintime50 commented 7 months ago

Hey @thattyson, thanks for submitting this!

The Typescript definition in this case is correct. Additionally, the screenshot you shared is of our old docs. You will want to view our new docs which we just released this last week which have the type corrected along with the clarification to use USD. Either way, using a float or string should work as we will coerce it to a float on the backend. The old docs will be taken offline in the next couple months and should be considered deprecated. Hope this helps!