-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Affected Resource(s)
- google_*
Background
What kind of contribution is this issue about?
- MMv1-based resource
Related PR(s), if any:
- Added support for google_datastream_connection_profile.bigquery_profile field GoogleCloudPlatform/magic-modules#6616
- Add new fields within
deidentify_configfield ofgoogle_data_loss_prevention_deidentify_templateresource GoogleCloudPlatform/magic-modules#6872
Details
Some APIs require a fields in a POST request payload to be an empty object. Until recently this wasn't possible to do, as validation of api.yaml files would assert that NestedObjects need to have at least one property defined.
This PR #6616 introduced the ability to define empty objects. In api.yaml you need to set properties: [] to bypass the validation error described above (along with setting send_empty_value and allow_empty_object to true).
This PR #6872 used the new feature and found a (benign) issue: when the empty object isn't included in the config the field is still sent in the payload of a POST request with a null value. This doesn't cause issues with the API in this particular PR, but it could change in future.
Example
Copy of this comment from the second PR:
If deidentify_template.deidentify_config.record_transformations.field_transformations.primitive_transformation.redact_config is set in the google_data_loss_prevention_deidentify_template resource config then the redactConfig field is present and contains an empty object in the payload:
{
"deidentifyTemplate": {
"deidentifyConfig": {
"recordTransformations": {
"fieldTransformations": [{
...
"primitiveTransformation": {
"redactConfig": {} ,
}
}]
}
},
...
}
}
If deidentify_template.......primitive_transformation.replace_config is set in the google_data_loss_prevention_deidentify_template resource config and redact_config is absent from the config then the redactConfig field is still present by has a null value in the payload:
{
"deidentifyTemplate": {
"deidentifyConfig": {
"recordTransformations": {
"fieldTransformations": [{
...
"primitiveTransformation": {
"redactConfig": null,
"replaceConfig": {
"newValue": {
"stringValue": "foobar"
}
}
}
}]
}
},
...
}
}