syntax = "proto2";

package wix.http;

import "google/protobuf/descriptor.proto";

option java_multiple_files = true;
option java_outer_classname = "FieldmaskProto";
option java_package = "com.wix.http";

/*
When (most commonly) update endpoint accepts FieldMask object, from REST client perspective it is redundant and can be
inferred from the actual JSON payload that was sent. This field annotation will tell the framework to use the JSON body
and automatically construct the fieldmask. E.g.
```
import "wix/http/field_mask.proto";

rpc UpdateProduct (UpdateProductRequest) returns (UpdateProductResponse) {
  option (google.api.http) = {
    PATCH: "/v1/products/{product.id}
  };
  option (wix.http.infer_fieldmask) = {
    from: "product"
    fieldmask: "mask"
  };
}

message UpdateProductRequest {
  Product product = 1;
  google.protobuf.FieldMask mask = 2;
}
```
*/
extend google.protobuf.FieldOptions {
  optional string infer_fieldmask_from = 50901 [deprecated=true];
}

extend google.protobuf.MethodOptions {
  optional InferFieldmask infer_fieldmask = 50902;
}

message InferFieldmask {
  required string from = 1; // ref to field on which we want to infer
  required string fieldmask = 2; // ref to actual fieldmask member
  optional bool snake_case_comma_separated_mask = 3; // recase comma-separated field mask to snake_case (legacy behavior)
}
