-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Which JS types are valid in fromObject, create, and encode? #719
Comments
There is a new Usage section in the README that tries to explain the differences. Basically, |
That's great, but it would be even greater if it also described what is considered "valid" and what kind of conversions |
Using this issue to create some documentation to copy to the README eventually. Let me know if I am missing something! What is a valid message? A valid message is an object not missing any required fields and exclusively using JS types for its fields that are understood by the wire format writer.
|
Is this approximately what you have been looking for? |
Looks good, but it doesn't mention that enum can be a string in the "naive conversion". I think it should also be mentioned which conversion is performed by Also IMO if you list Buffer objects as |
Added enums in the meantime. String is both String objects and string values. |
Looks great, thank you! |
Another thing. According to my experiments, if there's a |
This has changed lately to encode whatever is present. Related: #710 |
Closing this issue for now as it hasn't received any replies recently. Feel free to reopen it if necessary! |
For instance, in which cases am I allowed to specify enum values as strings rather than numbers?
When I use a string in
encode
it seems to fall back to the default value:But if I go through
fromObject
first then it works:But with
create
it works the same asencode
alone:Is all that documented somewhere?
The text was updated successfully, but these errors were encountered: