There's no way to add optional keyword for protobuf.
The optional keyword behaviour is not always the same and depend from the client language as well.
For example Go client has an option that defines the optional keyword behaviour.
So this can be solved only with decorators because there's no constant connection between the open api optional filed definition and protobuf optional keyword presence.
In this definition User has ordersCount that required in the api response and must have optional keyword to set default value to 0:
model User {
@field(1)
id: string;
@field(10)
address?: Address;
@optional // this is not implemented yet
@field(11)
ordersCount: int32 = 0;
}
Clear and concise description of the problem
There's no way to add
optional
keyword for protobuf. The optional keyword behaviour is not always the same and depend from the client language as well. For example Go client has an option that defines the optional keyword behaviour. So this can be solved only with decorators because there's no constant connection between the open api optional filed definition and protobuf optional keyword presence.In this definition User has
ordersCount
that required in the api response and must haveoptional
keyword to set default value to 0:Checklist