From 057912a0bac78d57e6c95ccecd865f27476e5006 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 9 Aug 2019 03:55:27 -0400 Subject: fix the provided openapi spec a lot of things marked required actually aren't --- ynab-api/src/models/transaction_detail.rs | 50 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'ynab-api/src/models/transaction_detail.rs') diff --git a/ynab-api/src/models/transaction_detail.rs b/ynab-api/src/models/transaction_detail.rs index 1558c7c..361813b 100644 --- a/ynab-api/src/models/transaction_detail.rs +++ b/ynab-api/src/models/transaction_detail.rs @@ -23,8 +23,8 @@ pub struct TransactionDetail { /// The transaction amount in milliunits format #[serde(rename = "amount")] pub amount: i64, - #[serde(rename = "memo")] - pub memo: String, + #[serde(rename = "memo", skip_serializing_if = "Option::is_none")] + pub memo: Option, /// The cleared status of the transaction #[serde(rename = "cleared")] pub cleared: String, @@ -32,26 +32,26 @@ pub struct TransactionDetail { #[serde(rename = "approved")] pub approved: bool, /// The transaction flag - #[serde(rename = "flag_color")] - pub flag_color: String, + #[serde(rename = "flag_color", skip_serializing_if = "Option::is_none")] + pub flag_color: Option, #[serde(rename = "account_id")] pub account_id: String, - #[serde(rename = "payee_id")] - pub payee_id: String, - #[serde(rename = "category_id")] - pub category_id: String, + #[serde(rename = "payee_id", skip_serializing_if = "Option::is_none")] + pub payee_id: Option, + #[serde(rename = "category_id", skip_serializing_if = "Option::is_none")] + pub category_id: Option, /// If a transfer transaction, the account to which it transfers - #[serde(rename = "transfer_account_id")] - pub transfer_account_id: String, + #[serde(rename = "transfer_account_id", skip_serializing_if = "Option::is_none")] + pub transfer_account_id: Option, /// If a transfer transaction, the id of transaction on the other side of the transfer - #[serde(rename = "transfer_transaction_id")] - pub transfer_transaction_id: String, + #[serde(rename = "transfer_transaction_id", skip_serializing_if = "Option::is_none")] + pub transfer_transaction_id: Option, /// If transaction is matched, the id of the matched transaction - #[serde(rename = "matched_transaction_id")] - pub matched_transaction_id: String, + #[serde(rename = "matched_transaction_id", skip_serializing_if = "Option::is_none")] + pub matched_transaction_id: Option, /// If the Transaction was imported, this field is a unique (by account) import identifier. If this transaction was imported through File Based Import or Direct Import and not through the API, the import_id will have the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1'. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2'. - #[serde(rename = "import_id")] - pub import_id: String, + #[serde(rename = "import_id", skip_serializing_if = "Option::is_none")] + pub import_id: Option, /// Whether or not the transaction has been deleted. Deleted transactions will only be included in delta requests. #[serde(rename = "deleted")] pub deleted: bool, @@ -67,22 +67,22 @@ pub struct TransactionDetail { } impl TransactionDetail { - pub fn new(id: String, date: String, amount: i64, memo: String, cleared: String, approved: bool, flag_color: String, account_id: String, payee_id: String, category_id: String, transfer_account_id: String, transfer_transaction_id: String, matched_transaction_id: String, import_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::SubTransaction>) -> TransactionDetail { + pub fn new(id: String, date: String, amount: i64, cleared: String, approved: bool, account_id: String, deleted: bool, account_name: String, payee_name: String, category_name: String, subtransactions: Vec<::models::SubTransaction>) -> TransactionDetail { TransactionDetail { id: id, date: date, amount: amount, - memo: memo, + memo: None, cleared: cleared, approved: approved, - flag_color: flag_color, + flag_color: None, account_id: account_id, - payee_id: payee_id, - category_id: category_id, - transfer_account_id: transfer_account_id, - transfer_transaction_id: transfer_transaction_id, - matched_transaction_id: matched_transaction_id, - import_id: import_id, + payee_id: None, + category_id: None, + transfer_account_id: None, + transfer_transaction_id: None, + matched_transaction_id: None, + import_id: None, deleted: deleted, account_name: account_name, payee_name: payee_name, -- cgit v1.2.3-54-g00ecf