[PHP] allow encoding enums as integers for json
The php extension already had an implementation for encoding enums as integers, but it was not exposed, so add params to Message::serializeToJsonString() to enable the behaviour. Since "preserve proto fieldnames" was already an (undocumented) boolean parameter of serializeToJsonString, I've continued that pattern by adding a second boolean param. Add the corresponding functionality to the native library, and add a test to verify the behavior.
Can I get any update on how this is progressing? I believe that it's been moved into google's internal systems and possibly being looked at there, but from the outside there's no sign of any activity.
We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.
This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.
Hi. This is still active, and awaiting work/feedback/something from a maintainer.
We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.
This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.
Still active. Please notice me.
We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.
This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.
Still active/required/wanted. Pretty please notice me.
@anandolee can I get an update on where this PR is at, since there's no visibility of what's happening behind the scenes? Thanks!
@bshaffer can you please take a look?
Apologies for the delay in getting this reviewed! Looks like most tests are failing -- could you rebase to latest main?
@bshaffer Friendly ping, are you able to take a look at this?
We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.
This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.
Still required, please don't close.
Could you tell us a little bit about your use-case? I imagine that there's a mismatch between how the server interprets enums and how the client is sending them? Or vice-versa?
Certainly. It's the latter: how the server interprets enums. My specific use-case is for the OpenTelemetry project. We use protobuf extensively as our primary encoding across many languages, and one of the options is JSON-encoded protobuf. The OpenTelemetry specification has deprecated being able to send an enum's string value, and it will stop working some time in the future. Documented here: https://opentelemetry.io/docs/specs/otlp/#json-protobuf-encoding
Values of enum fields MUST be encoded as integer values