-
Notifications
You must be signed in to change notification settings - Fork 11
EventHeartbeatPayload payload data structure error. #6
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
Comments
@zavierxu it's a greate issue about @huan I wonder if this is also a bug for wechaty-puppet ? |
What kind of bug so you think it is, could you please describe it in details? |
I wonder if this is also a bug for wechaty-puppet ? |
According to TypeScript handbook : https://www.typescriptlang.org/docs/handbook/interfaces.html#our-first-interface
So, it's valid in TypeScript, but not in Python |
@huan although this is valid in grammar, but |
Thanks for the explanation and the fix. It seems that the I believe we should always align with our golden truth from: export interface EventHeartbeatPayload {
data: string,
} However, when we receive a payload that contains unexpected property, it seems that the Python dataclass will raise an exception? Could we make the Python dataclass just ignore the unexpected property? If we can, I believe we can do that. Or if it can't, then I agree with you that the #7 will be a good workaround. At last, if we can find the reason that the puppet server sends the |
Ok,I will try to fix unexpected field exception at dataclass. |
There are several workgrounds,for example this one, but it seems there is not an official way to do this. |
I have proposed a PR at wechaty/python-wechaty-puppet-service#7, it's very concise and clean, I think it should be able to solve this problem? |
It seems that this issue has been solved. I will close this issue. |
When wechaty puppet recieved a heartbeat from hostie, an error occured:
TypeError: __init__() got an unexpected keyword argument 'timeout'
python-wechaty-puppet/src/wechaty_puppet/schemas/event.py
Lines 132 to 134 in 984e173
Here class
EventHeartbeatPayload()
only defined one of the argumentsdata
, lefttimeout
behind, which may cause this error.The text was updated successfully, but these errors were encountered: