andrewthetechie / geekbot-api-py

A Geekbot (https://geekbot.com/) API client in python supporting async
MIT License
1 stars 2 forks source link

Listing standups requires 'personalized' bool in JSON response, but it's not present #3

Closed CodingDavid8 closed 2 years ago

CodingDavid8 commented 2 years ago

Hi there! 👋 Thanks for your work so far, looks like a really helpful package, just stumbled on it :)

I wrote a simple test iny my package that looks something like this:

def test_standup_connection():
    standups = []
    for standup in geekbot.instance.client.standups.list():
        standups.append(standup)

    print(standups)

However, I always get a ValidationError when calling the list() method:

test_geekbot.py::test_standup_connection FAILED                          [100%]
test_geekbot.py:7 (test_standup_connection)
def test_standup_connection():
        standups = []
>       for standup in geekbot.instance.client.standups.list():

test_geekbot.py:10: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Python39\lib\site-packages\geekbot_api\clients\standups.py:22: in list
    yield Standup(**standup)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   pydantic.error_wrappers.ValidationError: 1 validation error for Standup
E   personalized
E     field required (type=value_error.missing)

pydantic\main.py:406: ValidationError

I already debugged the code and found the root of the problem. By setting a breakpoint at the yield, I saw that my json was lacking of the personalized boolean that is required in the StandupBase class.

json

I'm not familiar with pydantic, but I think it should be quite easy to fix this.

What is the personalized value used for anyway? Do you have any idea when it is present or not? It might be because I didn't create the standup myself.

CodingDavid8 commented 2 years ago

Ok basically making the field an Optional already fixed it :D