dmlerner / ynab-api

Generated Python API for YNAB
32 stars 10 forks source link

Missing DEBT goal_type for categories #16

Open borsboom opened 1 year ago

borsboom commented 1 year ago

When I run this code:

import ynab_api
from ynab_api.api import categories_api
ynab_configuration = ynab_api.Configuration()
ynab_configuration.api_key_prefix['bearer'] = 'Bearer'
ynab_configuration.api_key['bearer'] = 'REDACTED'
ynab_client = ynab_api.ApiClient(ynab_configuration)
categories_api_instance = categories_api.CategoriesApi(ynab_client)
categories_response = categories_api_instance.get_categories('REDACTED')

I get this exception:

ynab_api.exceptions.ApiValueError: Invalid inputs given to generate an instance of 'CategoryGroupWithCategoriesAllOf'. The input data was invalid for the allOf schema 'CategoryGroupWithCategoriesAllOf' in the composed schema 'CategoryGroupWithCategories'. Error=Invalid value for `goal_type` (DEBT), must be one of [None, 'TB', 'TBD', 'MF', 'NEED']

I can locally add 'DEBT': 'DEBT' to the allowed_values for goal_type in model/category.py, and then it works fine, but maybe this means the code needs to be regenerated from the OpenAPI definition?

borsboom commented 1 year ago

Looks like #14 includes this change, as well as another one I'm hoping for (deleting transactions)

dmlerner commented 1 year ago

Unfortunately, there's no easy fix here. I looked at that PR and emailed some with the author. It fixed some things, but broke others. If you're interested, I can dig up my bigger test suite - I will be happy to merge a PR that passes it.

borsboom commented 1 year ago

@dmlerner I've opened #17, which adds both the features I need.