Skip to content

Conversation

@jwhited
Copy link

@jwhited jwhited commented Nov 11, 2025

It's a string, not a float. A float makes sense, but I only get strings
back on the wire.

Fixes #848

It's a string, not a float. A float makes sense, but I only get strings
back on the wire.

Fixes linode#848

Signed-off-by: Jordan Whited <jordan@tailscale.com>
Copilot AI review requested due to automatic review settings November 11, 2025 22:38
@jwhited jwhited requested a review from a team as a code owner November 11, 2025 22:38
@jwhited jwhited requested review from vshanthe and yec-akamai and removed request for a team November 11, 2025 22:38
Copilot finished reviewing on behalf of jwhited November 11, 2025 22:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a type mismatch in the InvoiceItem.UnitPrice field, changing it from float32 to string to match the actual API response format.

  • Changed InvoiceItem.UnitPrice field type from float32 to string
  • Updated test fixture and test assertion to reflect the corrected type

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
account_invoices.go Changed UnitPrice field type from float32 to string in the InvoiceItem struct
test/unit/fixtures/account_invoice_items_list.json Updated test fixture to represent unit_price as a string value instead of a number
test/unit/account_invoices_test.go Updated test assertion to compare UnitPrice against a string value instead of float32

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +32 to 35
UnitPrice string `json:"unit_price"`
Quantity int `json:"quantity"`
Amount float32 `json:"amount"`
Tax float32 `json:"tax"`
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The InvoiceItem struct has inconsistent numeric types. While UnitPrice is now correctly a string to match the API response, other monetary fields (Amount, Tax, Total) remain as float32. Consider whether these fields also return as strings from the API. If they do, they should be changed to string for consistency. If they're actually returned as numbers, the inconsistency should be documented to explain why UnitPrice is treated differently.

Copilot uses AI. Check for mistakes.
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

Successfully merging this pull request may close these issues.

[Bug]: InvoiceItem.UnitPrice is a string

1 participant