Skip to content

Conversation

@Droeftoeter
Copy link

This will set the default value for packed to true if the field is a repeated field with a numeric type.

@Droeftoeter
Copy link
Author

The tests don't reflect the change yet. I've read that the repeated numeric fields are only packed by default in proto3. Maybe we should check for that.

@FabioBatSilva
Copy link
Member

Hi @Droeftoeter,
Thanks for your contribution

Can you point me to docs on this ?

Also we should be able to check the proto version using this : https://github.com/protobuf-php/google-protobuf-proto/blob/master/src/descriptor.proto#L88

@Droeftoeter
Copy link
Author

@FabioBatSilva
Copy link
Member

Thanks for the PR @Droeftoeter,

A couple points that need to be addressed before we merge it.

  • We should check the PB version before defaulting it to [packed=true]
  • Also need o take care of writing the values
  • It might be easier to wrap/modify FieldDescriptorProto#options and default packed to true when using proto3

@Droeftoeter
Copy link
Author

I agree, I will update the PR soon

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

Successfully merging this pull request may close these issues.

2 participants