Skip to content
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

Error in users field for AuthorizationGroups model validation #90

Open
chinchy opened this issue Jan 22, 2025 · 1 comment · May be fixed by #91
Open

Error in users field for AuthorizationGroups model validation #90

chinchy opened this issue Jan 22, 2025 · 1 comment · May be fixed by #91
Labels
bug Something isn't working

Comments

@chinchy
Copy link

chinchy commented Jan 22, 2025

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
@chinchy chinchy added the bug Something isn't working label Jan 22, 2025
Copy link

We've received your issue. Thanks for your patience.

@chinchy chinchy linked a pull request Jan 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant