-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Max length for memo
and payee_name
does not match what YNAB allows
#77
Comments
memo
and payee_name
does not match what YNAB allows?memo
and payee_name
does not match what YNAB allows
Following up on #5, I tried to make the transaction memo better, while also making sure it won't break YNAB API's current limit of 200 characters. ([Which I think should be abolished.](ynab/ynab-sdk-ruby#77) 😬)
Following up on #5, I tried to make the transaction memo better, while also making sure it won't break YNAB API's current limit of 200 characters. ([Which I think should be abolished.](ynab/ynab-sdk-ruby#77) 😬)
@davidstosik thanks for the feedback! The API does indeed have smaller limits for some fields; this is intentional and by design. Having said that, if you have a specific use case for increasing these a bit, we can consider that. |
@bradymholt thanks for the reply! As for a use case, you can check my previous issue that I linked in the description above: basically, it's impossible to write a script that fetches existing transactions, changes them then saves them again, since you might be fetching transactions that were created in the UI and will appear invalid from the API. I sometimes use the description to take notes about a given transaction and it can exceed 200 chars, seldomly. |
Ah, I see. Thanks for the context. As I mentioned, we intentionally limit these in the API to prevent abuse. Is there a limit we could increase it to (short of the limit the apps allows) that would allow you to proceed, even if you needed to trim in some cases when saving a transaction from the API? |
@bradymholt Sorry it took me some time to get back to you. # frozen_string_literal: true
require "ynab"
puts "Fetching data..."
ynab_api = YNAB::API.new(ENV["YNAB_ACCESS_TOKEN"])
budget = ynab_api.budgets.get_budgets.data.budgets.sort_by(&:last_modified_on).last
transactions = ynab_api.transactions.get_transactions(budget.id).data.transactions
puts <<~OUTPUT
Fetched #{transactions.count} transactions.
Three longest memo sizes: #{transactions.filter_map(&:memo).map(&:length).uniq.max(3).join(", ")}
Three longest payee name sizes: #{transactions.filter_map(&:payee_name).map(&:length).uniq.max(3).join(", ")}
OUTPUT
So I've got old transactions in my budget with memo and payee name that exceed the current validations. (I'm actually surprised the YNAB gem did not fail to load the data, as it does with invalid flag colors, here. 😅) I'm writing an import script that allows me to import into YNAB transactions from my various Japanese bank accounts. (There's no account linking here!) I understand that removing the limits would favor abuse, but do you think that it would be possible to:
|
@davidstosik - Thanks for the feedback. I understand the friction that can be caused by having different limits on the clients and the API. I'll raise this internally to see about some better alignment there. In the meantime, we can increase the limits on allowed by the server for |
Update - This increase in limit is scheduled to ship early next week. |
@bradymholt thank you very much! |
@bradymholt May I ask for an update on this? (Nothing urgent, just wondering if anything went out, since I don't see a new release of the gem.) 🙏🏻 |
@davidstosik - The server change (1.72.1) went out back in July but we didn't mention on the release notes since it was a very minor patch. Honestly, I didn't think a new client would be needed for this change but now I see that indeed there is a some validation logic that checks the length against the spec. I'll cut a new release here in just a minute! Thanks for the ping. |
Hi there! 👋🏻
First I've got to state again how happy I am using YNAB and the API for my own workflow, this is working great!
I recently noticed that some field maximum lengths might not match the actual length limits when using the YNAB web client.
In short, the OpenAPI spec file specifies a
maxLength
forpayee_name
andmemo
fields of respectively 50 and 200, but it's been possible for a long time to create transactions with longer payee name and memo. (I just created a transaction with a 10,000-character long memo!)I think this issue is very similar to this other issue I opened back in February last year: Validation error on API response for TransactionDetail#import_payee_name, and that it could get a similar fix (Remove unnecessary maxLength validation for import payee fields).
One thing I noticed that might have not been the case last year, is that even if I remove the validations Ruby-side, the API actually responds with an error too:
I could imagine this is happening if YNAB's API server code is also generated with the OpenAPI Generator, based on the same OpenAPI spec. In this case, the fix would require not only a new version of this gem but also an update of YNAB's server-side API code.
Hope this makes sense, but feel free to let me know if you need more details! 🙏🏻
The text was updated successfully, but these errors were encountered: