Correct the models against what a real server actually sends
Every one of these was wrong in a way the mock tests could not see, because the mocks were written from the same upstream source the models were. - `SystemLog.created_at`/`updated_at` are integer timestamps, not the date strings the OpenAPI spec declares. - `frequency_id` arrives as a numeric string on recurring invoices and expenses, so both now decode through `int_or_numeric_string`. - `Location.country_id`, `PurchaseOrder.status_id` and `Webhook.format` are omitted when empty. The server runs `ConvertEmptyStringsToNull`, so an unset `String` sent as `""` becomes NULL and then fails a non-null column or an `integer` rule — which meant a create from a `Default` model could not succeed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,8 +25,9 @@ pub struct RecurringInvoice {
|
||||
#[serde(default, deserialize_with = "super::common::null_to_default")]
|
||||
pub status_id: String,
|
||||
/// How often the invoice recurs. Invoice Ninja returns this as an integer
|
||||
/// enum (1 = daily, 2 = weekly, … ), not a human-readable string.
|
||||
#[serde(default, deserialize_with = "super::common::null_to_default")]
|
||||
/// enum (1 = daily, 2 = weekly, … ), not a human-readable string. A real
|
||||
/// server sends it as a numeric string; both decode.
|
||||
#[serde(default, deserialize_with = "super::common::int_or_numeric_string")]
|
||||
pub frequency_id: i64,
|
||||
/// Number of cycles left to send; `-1` means it recurs indefinitely.
|
||||
#[serde(default, deserialize_with = "super::common::null_to_default")]
|
||||
|
||||
Reference in New Issue
Block a user