protoc-gen-twirpql icon indicating copy to clipboard operation
protoc-gen-twirpql copied to clipboard

support deprecation

Open tmc opened this issue 5 years ago • 3 comments

Do you plan to support field metadata such as isDeprecated/deprecationReason?

tmc avatar Jul 14 '19 21:07 tmc

@tmc yes, I plan on pushing deprecated fields to master sometime tomorrow :)

But how would deprecationReason be translated from protocol buffers? I don't think the protobuf spec supports deprecation reason right? Protoc-gen-go basically just puts do not use as the reason.

marwan-at-work avatar Jul 14 '19 23:07 marwan-at-work

The two options that come to mind are parsing a comment or introducing a protobuf extension to allow supplying structured metadata.

tmc avatar Jul 14 '19 23:07 tmc

@tmc I already have a few extensions here which I haven't written documentation for yet.

I think we can add a free-form directive option. Such as:

message X {
  string y = 1 {
    option (twirpql.options.field) = {
      directives = ["@deprecated(reason: whatever)", "@key"]
    }
  };
}

TwirpQL can still support the original deprecated option as well, but it would prioritize the custom inputs

marwan-at-work avatar Jul 15 '19 00:07 marwan-at-work