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

Can we get some better documentation on how Json deserialization is supposed to work? #70

Closed
empath opened this issue Jan 1, 2018 · 2 comments

Comments

@empath
Copy link

empath commented Jan 1, 2018

Doing a simple modification of the dashboard example to add a second field makes the 'fetch data' button break completely, with no error in the compilation or in console:

I changed data.json to:
{
"value": 123,
"foo": "bar"
}

and struct Status to:

struct Status {
value: u32,
foo: String
}

(and also updated the websocket update function to match, but i don't think that matters.)

Is there something else I need to do?

@empath
Copy link
Author

empath commented Jan 2, 2018

Actually this seems to be working now, I'm not sure what the issue was. But I would like some better documentation/error handling, because it seems to drop any kind of deserialization errors on the floor as is.

@therustmonk
Copy link
Member

Thank you for the feedback! I think the dashboard example is a bit confusing. It uses the same type for everything: web-request, ws-request, ws-response. serde follows the type declaration in deserialization strictly. If you change any field in Status type it have to be changed everywhere (in data.json file and in websocket interaction). I've fixed it with #72 to make this example more friendly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants