Skip to content

Error in users field for AuthorizationGroups model validation #90

@chinchy

Description

@chinchy

Describe the bug
Pydantic model AuthorizationGroups has incorrect validation for the users field.
This field has the following type annotation: users: Optional[Dict[str, StrictStr]] = None. However, the validation processes the field value like a string.

To Reproduce
Short script for reproduction:

from fireblocks.models import AuthorizationGroups

auth_group = {"th": 1, "users": {"00000000-0000-0000-0000-000000000000": "NA"}}

AuthorizationGroups.from_dict(auth_group)

Expected behavior
Dict data was validated, and the model object was created.

Actual Behavior

Traceback (most recent call last):
  File "<input>", line 5, in <module>
  File "/Users/user1/Library/Caches/pypoetry/virtualenvs/test-TTiCIVEu-py3.12/lib/python3.12/site-packages/fireblocks/models/authorization_groups.py", line 94, in from_dict
    _obj = cls.model_validate({
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Library/Caches/pypoetry/virtualenvs/test-TTiCIVEu-py3.12/lib/python3.12/site-packages/pydantic/main.py", line 627, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user1/Library/Caches/pypoetry/virtualenvs/test-TTiCIVEu-py3.12/lib/python3.12/site-packages/fireblocks/models/authorization_groups.py", line 40, in users_validate_enum
    if value not in set(['PENDING_AUTHORIZATION', 'APPROVED', 'REJECTED', 'NA']):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'dict'

Versions (please complete the following information):

  • Python Version: 3.12.8
  • Fireblocks py-sdk version: 7.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions