ms32035 / firefly-iii-client

Python client for Firefly III API. Please read .generator/Readme.md
19 stars 8 forks source link

Generator doesn't create allowed null entries correct #14

Closed rummens closed 11 months ago

rummens commented 2 years ago

It seems there is a bug in the generator, it doesn't handle some attributes which can be null correctly. I think its a bug because the OpenAPI looks good to me (s. below). The module complains for GET requests on non liability Asset that the attributes are not set (i.e. null).

So far I found these:

image

For your convenience I attach the fixed Python script:

Account:

[...]

class Account(ModelNormal):
   [...]
    @cached_property
    def openapi_types():
        """
        This must be a method because a model may have properties that are
        of type self, this must run after the class is loaded

        Returns
            openapi_types (dict): The key is attribute name
                and the value is attribute type.
        """
        return {
            'name': (str,),  # noqa: E501
            'type': (str,),  # noqa: E501
            'account_number': (str, none_type,),  # noqa: E501
            'account_role': (str, none_type,),  # noqa: E501
            'active': (bool,),  # noqa: E501
            'bic': (str, none_type,),  # noqa: E501
            'created_at': (datetime,),  # noqa: E501
            'credit_card_type': (str, none_type,),  # noqa: E501
            'currency_code': (str,),  # noqa: E501
            'currency_decimal_places': (int,),  # noqa: E501
            'currency_id': (str,),  # noqa: E501
            'currency_symbol': (str,),  # noqa: E501
            'current_balance': (str, none_type,),  # noqa: E501
            'current_balance_date': (datetime,),  # noqa: E501
            'current_debt': (str,none_type,),  # noqa: E501
            'iban': (str, none_type,),  # noqa: E501
            'include_net_worth': (bool,),  # noqa: E501
            'interest': (str, none_type,),  # noqa: E501
            'interest_period': (str, none_type,),  # noqa: E501
            'latitude': (float, none_type,),  # noqa: E501
            'liability_direction': (str, none_type,),  # noqa: E501
            'liability_type': (str, none_type,),  # noqa: E501
            'longitude': (float, none_type,),  # noqa: E501
            'monthly_payment_date': (datetime, none_type,),  # noqa: E501
            'notes': (str, none_type,),  # noqa: E501
            'opening_balance': (str,),  # noqa: E501
            'opening_balance_date': (datetime, none_type,),  # noqa: E501
            'order': (int, none_type,),  # noqa: E501
            'updated_at': (datetime,),  # noqa: E501
            'virtual_balance': (str,),  # noqa: E501
            'zoom_level': (int, none_type,),  # noqa: E501
        }
[...]

PiggyBank:

[...]

class PiggyBank(ModelNormal):
   [...]

    @cached_property
    def openapi_types():
        """
        This must be a method because a model may have properties that are
        of type self, this must run after the class is loaded

        Returns
            openapi_types (dict): The key is attribute name
                and the value is attribute type.
        """
        return {
            'account_id': (str,),  # noqa: E501
            'name': (str,),  # noqa: E501
            'target_amount': (str,),  # noqa: E501
            'account_name': (str,),  # noqa: E501
            'active': (bool,),  # noqa: E501
            'created_at': (datetime,),  # noqa: E501
            'currency_code': (str,),  # noqa: E501
            'currency_decimal_places': (int,),  # noqa: E501
            'currency_id': (str,),  # noqa: E501
            'currency_symbol': (str,),  # noqa: E501
            'current_amount': (str,),  # noqa: E501
            'left_to_save': (str,),  # noqa: E501
            'notes': (str, none_type,),  # noqa: E501
            'object_group_id': (str, none_type,),  # noqa: E501
            'object_group_order': (int, none_type,),  # noqa: E501
            'object_group_title': (str, none_type,),  # noqa: E501
            'order': (int,),  # noqa: E501
            'percentage': (float,),  # noqa: E501
            'save_per_month': (str,),  # noqa: E501
            'start_date': (datetime, none_type,),  # noqa: E501
            'target_date': (datetime, none_type,),  # noqa: E501
            'updated_at': (datetime,),  # noqa: E501
        }

  [...]
rummens commented 2 years ago

Also I had to add --reserved-words-mappings self=self to the generator.sh to fix an issue in the Tag API described here: https://github.com/OpenAPITools/openapi-generator/issues/7119

ms32035 commented 2 years ago

The first issue is a problem with OpenAPI generator, not this project. For the second issue, you can raise a PR if urgent, otherwise I'll have a look next time I regenerate.

ms32035 commented 11 months ago

Closed as stale