-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat: support requesting numeric enum rest encoding #395
Conversation
@bshaffer this is ready for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'll PHP experts give the final approval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved but one thing that surprises me about this is nothing is required client side to prepare for the response? Is that because we expect it to be handled automatically by protobuf
? And would we benefit from any kind of mocking / test case for this scenario?
Yes, protobuf (de)serialization handles numbers or strings for enum fields. I tested it manually before, during the exploration phase of the encoding stuff. Most protobuf JSON serializers handle either string or number for enum fields smoothly. |
Support the top-level REST descriptor config option
numericEnums
which enables inclusion of the$alt=json;enum-encoding=int
system parameter that requests that enums be encoded as integers instead of strings. This is a Google System parameter. This is an API-wide configuration hence its spot at the same level asinterfaces
This will be coupled with a generator change to include the REST descriptor config option in the generated output when a generator option is supplied.