Allow disabling trailers#809
Conversation
| val fs2GrpcDisableTrailers = | ||
| settingKey[Boolean]("Disable generation of the trailers") |
There was a problem hiding this comment.
As an alternative, we can extend CodeGeneratorOption.
There was a problem hiding this comment.
How would that look like?
There was a problem hiding this comment.
We can add a new option:
object CodeGenerationOptions {
...
case object Fs2GrpcDisableTrailers extends CodeGeneratorOption {
override def toString: String = "fs2_grpc:disable_trailers"
}
}Here is a complete example: iRevive#1
There was a problem hiding this comment.
I see. Not sure if that is preferable. Then we have two ways of customizing fs2grpc things, one for the serviceSuffix and one for fs2_grpc:disable_trailers, right?
There was a problem hiding this comment.
Yes. If we want to follow the new code-generation option path, we should deprecate fs2GrpcServiceSuffix and replace it with CodeGeneratorOption.Fs2GrpcServiceSuffix(suffix: String).
But I'm not sure it's worth it.
There was a problem hiding this comment.
If CodeGeneratorOption is the recommendation then I think it is worth it. Now is the time to do breaking changes.
There was a problem hiding this comment.
Great, let's move to CodeGeneratorOption then.
I will move fs2GrpcServiceSuffix to the CodeGeneratorOption in the follow-up PR. Let's deprecate the fs2GrpcServiceSuffix plugin key and keep it around for a while so that users can migrate.
Motivation
In some cases, trailer classes are not needed and only add compilation overhead, especially with many services. They remain enabled by default, but an option is now available to disable them.