-
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
When defaults=false, arrays are initialized as null #597
Comments
Not exactly sure that there should be an option to handle just array defaults while excluding everything else. I feel like this is too much of a special case. |
I understand the feel of special case. But because of v5 there are several places where this is done and even at our scale of code size it's a nightmare. For arrays in every language other than protobufjs arrays are never null. Which makes the null representation here stick out as a exception. And this is independent of proto2/3 |
So, the array field values are explicitly set to |
I mean set to null instead of default initialized [] |
Can you provide additional information on your use case or an example? I am somewhat puzzled. |
Let's say a parsed proto object looks like Message MyProto {
optional int32 some_int = 1;
repeated int32 some_array = 2;
repeated int32 other_array = 3;
} Let's say it parsed a datastream and looked like this. But on converting to JSON |
👍 |
Reopening to address 40074bb#comments |
@dcodeIO Hope you get a chance to address this again, last remaining blocker for us. |
Have you tried again with master, lately? |
Closing this for now as 6.4.0, which is now released, should solve the issue. Feel free to reopen the issue if necessary. |
V5 behavior has been that arrays are always initialized. Can we get the same behavior back via an JSONConversionOption. We don't want non-arrays to be initialized to defaults, but there are several places where arrays need to be initialized to []
#MigrationPains
The text was updated successfully, but these errors were encountered: