You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occurrence details vary depending on the kind and so are implemented using a oneof field in the protobuf definition
Generally, oneof fields aren't treated as part of the message and instead the actual name of the set field is used. For instance, there's no details field when using protojson to serialize an occurrence. They also shouldn't appear in field masks.
However, the fieldmask-utils library used in occurrence updates requires that to be passed, see this issue for more details:
This is easy to work around when calling Grafeas using gRPC; however, it's more of an issue with HTTP requests. Because of the design of the Grafeas protos, it's not possible to pass the field mask in the request; instead gRPC gateway fills in the mask automatically based on the request body.
As a result it doesn't seem possible to update the details of an occurrence using HTTP.
In terms of fixing it there doesn't seem to be an official method for merging that takes into account the field mask. See this issue:
https://github.com/golang/protobuf/issues/1296
There's a proto.Merge function; however it doesn't take a field mask. Its behavior is also such that arrays are concatenated, rather than replaced and that's not configurable.
It might be easiest to use something like mergo to handle the actual merge and then see what options are available for filtering the request body using the field mask.
The text was updated successfully, but these errors were encountered:
From this discussion: rode/collector-build#4 (comment)
Occurrence details vary depending on the kind and so are implemented using a
oneof
field in the protobuf definitionGenerally,
oneof
fields aren't treated as part of the message and instead the actual name of the set field is used. For instance, there's nodetails
field when usingprotojson
to serialize an occurrence. They also shouldn't appear in field masks.However, the
fieldmask-utils
library used in occurrence updates requires that to be passed, see this issue for more details:This is easy to work around when calling Grafeas using gRPC; however, it's more of an issue with HTTP requests. Because of the design of the Grafeas protos, it's not possible to pass the field mask in the request; instead gRPC gateway fills in the mask automatically based on the request body.
As a result it doesn't seem possible to update the details of an occurrence using HTTP.
In terms of fixing it there doesn't seem to be an official method for merging that takes into account the field mask. See this issue:
There's a
proto.Merge
function; however it doesn't take a field mask. Its behavior is also such that arrays are concatenated, rather than replaced and that's not configurable.It might be easiest to use something like
mergo
to handle the actual merge and then see what options are available for filtering the request body using the field mask.The text was updated successfully, but these errors were encountered: