-
Notifications
You must be signed in to change notification settings - Fork 50
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
gapic: non-optional number fields are excluded from REST query params if value is 0 #819
Comments
I think this will be a problem for both DIREGAPIC and REGAPIC. With DIREGAPIC, it is easier to handle because the protos are generated as either With I think we can start by continuing to use the same For all (REGAPIC and DIREGAPIC) number fields annotated as To help reduce the chance of the aforementioned unset |
#820 for required field documentation improvements. |
That is indeed the behavior we should have. Sorry it wasn't called out explicitly for query params in the internal design doc...or included in integration tests. I will address those two points. Thanks for catching this! |
A required, singular, primitive type field will always be added as a query param when configured as one, whether the default empty value of the primitive is used or not. Note: Also added some constants for proto field types to improve readability. Fixes #819
Currently, REST transport implementations check if a number field (e.g.
int32
) is0
or not, and will only include the field's value in request params if it is not0
. Example.This could be a problem since
0
is both a valid value in many cases and the default empty/unset value for typeint32
(which is why it is being checked in the first place).Specifically, in DIREGAPIC compute, the only non-optional number fields are also annotated
REQUIRED
, and in all cases0
is a valid value. This results in BadRequest errors because a field that is required is not sent when it is0
, which is a valid value. See googleapis/google-cloud-go#5174.The text was updated successfully, but these errors were encountered: