The YNAB API is working very well and I'm thankful this gem is available, making it super easy to write scripts to import transactions.
However, I am experiencing an error which to me looks weird and unjustified. I'm not sure whether this is a bug, but I thought I'd report what I'm seeing and ask for opinions.
I have a script which goal is to create YNAB transactions in my account, based on local CSV data. It initializes a YNAB::PostTransactionsWrapper in which the transactions keyword argument is an Array of Hashes with the necessary transaction keys/properties.
The script then uses the TransactionsApi's #create_transaction method to send the data to YNAB, which usually goes well.
Sometimes though, that calls raises an exception:
#<ArgumentError: invalid value for "import_payee_name", the character length must be smaller than or equal to 200.>
I can verify on my YNAB account that all the transactions were created correctly, so my guess is that the error is raised after the gem received a successful response from the API.
It looks like the gem attempts to deserialize the response into a SaveTransactionResponse, which is supposed to include each created transaction, deserialized as a TransactionDetail. Unfortunately, it seems that the deserialization fails when the import_payee_name validation fails:
I don't recall ever importing data with 200+ character long payee names, but even if I did, I think there is a consistency problem between the gem and the API:
the API happily returns 200+ character long import_payee_names in a successful response (so they're valid data, right?)
the gem arbitrarily decides that the data returned by the API is in fact invalid.
The error does not really impact my process: the transactions I want to create get created with no issue, and I'm currently not making any use of the response, but I think this is a smell that might be worth fixing.
Please let me know if I can help in any way.
(@bradymholt It looks like you've been maintaining this gem for a while, so please allow me to ping you in the issue. 🙇🏻♂️ )
Hi there! 👋🏻
The YNAB API is working very well and I'm thankful this gem is available, making it super easy to write scripts to import transactions.
However, I am experiencing an error which to me looks weird and unjustified. I'm not sure whether this is a bug, but I thought I'd report what I'm seeing and ask for opinions.
I have a script which goal is to create YNAB transactions in my account, based on local CSV data. It initializes a
YNAB::PostTransactionsWrapper
in which thetransactions
keyword argument is an Array of Hashes with the necessary transaction keys/properties.The script then uses the TransactionsApi's
#create_transaction
method to send the data to YNAB, which usually goes well.Sometimes though, that calls raises an exception:
I can verify on my YNAB account that all the transactions were created correctly, so my guess is that the error is raised after the gem received a successful response from the API.
It looks like the gem attempts to deserialize the response into a
SaveTransactionResponse
, which is supposed to include each created transaction, deserialized as aTransactionDetail
. Unfortunately, it seems that the deserialization fails when theimport_payee_name
validation fails:https://github.com/ynab/ynab-sdk-ruby/blob/f14a86668e3d216aef94fbc2ee202a96d9bcb979/lib/ynab/models/transaction_detail.rb#L280-L282
I don't recall ever importing data with 200+ character long payee names, but even if I did, I think there is a consistency problem between the gem and the API:
import_payee_names
in a successful response (so they're valid data, right?)The error does not really impact my process: the transactions I want to create get created with no issue, and I'm currently not making any use of the response, but I think this is a smell that might be worth fixing.
Please let me know if I can help in any way.
(@bradymholt It looks like you've been maintaining this gem for a while, so please allow me to ping you in the issue. 🙇🏻♂️ )