Closed tattali closed 4 years ago
Hi @kjk, I am new with golang, and I don't understand this error.
Which error?
Well in smoke tests.
It means that the structure of json and the Go struct don't match. Specifically it tells you that json has an array but your struct definition has just a struct. That leads to decoding error.
Hi @kjk, I think it might be because there is some cache somewhere with still an array sent to Query.filter, but I don't know where. All snapshots have a filter property to null
Thanks for your help
Hi, do you have an advice ?
Because I don't understand how to make the QueryFilterWrapper
nullable.
If this is really the issue.
Thank you very much
Maybe this because in your notion use for tests there is any filters ?
Hi @kjk do you think this is a fixable error? Because it seems to be only in the tests, not when I use the changes locally.
Hi @kjk I am still stuck with this error
Sorry, I don't have the bandwidth to debug other's people code.
Hi, @tattali
You're binding an array to a map. You've changed the type of Query.Filter
from []*QueryFilter
to *QueryFilterWrapper
, but query.filter
in the actual JSON response is an array.
ex) from smoke test page
[{id: "4071292f-ac9b-4b6a-b40d-e2d55f3a5003", type: "select", value: "Notion", property: "RA!P",…}]
You can write your own Unmarshal() to bind an array to QueryFilterWrapper.QueryFilterGroup
properly.
Related to #24
I update a bit the types