.../ynab-3.4.0/lib/ynab/models/transaction_flag_color.rb:39:in `build_from_hash': Invalid ENUM value for class #TransactionFlagColor (RuntimeError)
from .../ynab-3.4.0/lib/ynab/models/transaction_flag_color.rb:31:in `build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:431:in `_deserialize'
(continued...)
```
from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:386:in `block in build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:376:in `each_pair'
from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:376:in `build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:171:in `_deserialize'
from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:123:in `block (2 levels) in build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:123:in `map'
from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:123:in `block in build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:116:in `each_pair'
from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:116:in `build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:158:in `_deserialize'
from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:113:in `block in build_from_hash'
from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:103:in `each_pair'
from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:103:in `build_from_hash'
from .../ynab-3.4.0/lib/ynab/api_client.rb:282:in `convert_to_type'
from .../ynab-3.4.0/lib/ynab/api_client.rb:242:in `deserialize'
from .../ynab-3.4.0/lib/ynab/api_client.rb:73:in `call_api'
from .../ynab-3.4.0/lib/ynab/api/transactions_api.rb:296:in `get_transactions_with_http_info'
from .../ynab-3.4.0/lib/ynab/api/transactions_api.rb:240:in `get_transactions'
```
I've also confirmed that the error started happening in the version 3.0.0 of the gem.
Hacking into the gem a little bit, I was able to find that my budget contains a transaction which flag is an empty string, when returned from the API, then I confirmed it by also querying the API directly:
This might have been caused by a change in data format, combined with new validations added in recent versions of the gem.
I'm trying to fetch all transactions in a budget using the API:
And I get the following error:
(continued...)
``` from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:386:in `block in build_from_hash' from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:376:in `each_pair' from .../ynab-3.4.0/lib/ynab/models/transaction_detail.rb:376:in `build_from_hash' from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:171:in `_deserialize' from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:123:in `block (2 levels) in build_from_hash' from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:123:in `map' from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:123:in `block in build_from_hash' from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:116:in `each_pair' from .../ynab-3.4.0/lib/ynab/models/transactions_response_data.rb:116:in `build_from_hash' from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:158:in `_deserialize' from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:113:in `block in build_from_hash' from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:103:in `each_pair' from .../ynab-3.4.0/lib/ynab/models/transactions_response.rb:103:in `build_from_hash' from .../ynab-3.4.0/lib/ynab/api_client.rb:282:in `convert_to_type' from .../ynab-3.4.0/lib/ynab/api_client.rb:242:in `deserialize' from .../ynab-3.4.0/lib/ynab/api_client.rb:73:in `call_api' from .../ynab-3.4.0/lib/ynab/api/transactions_api.rb:296:in `get_transactions_with_http_info' from .../ynab-3.4.0/lib/ynab/api/transactions_api.rb:240:in `get_transactions' ```I've also confirmed that the error started happening in the version 3.0.0 of the gem.
Hacking into the gem a little bit, I was able to find that my budget contains a transaction which flag is an empty string, when returned from the API, then I confirmed it by also querying the API directly:
A transaction with an empty string for flag color is invalid, according to the OpenAPI spec:
https://github.com/ynab/ynab-sdk-ruby/blob/825a49af31fa8bd10ee7406fc40bf72955a1b406/open_api_spec.yaml#L3276-L3287
I can picture three ways to fix this problem:
flag_color
To me, the real fix would be number 3.