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
Protobuf specifications support options. Options are strongly typed Protobuf values. Options are primarily found at the file level, message level and field level of a specification. There doesn't yet exist a representation of Protobuf options within a Sysl specification.
Proposal
Support the encoding of file level, service level, method level, message level and field level Protobuf options by including their Protobuf-encoded values within Sysl annotations.
Protobuf Encoding
Consider the following Protobuf example that includes various options:
Protobuf options found at the service level, method level, message level and field level map to annotations on their corresponding Sysl application, endpoint, type and field declarations respectively. Protobuf file level options are included in all Sysl applications that are defined within the Protobuf file containing these values.
Alternatives Considered
Encode Natively
Some Protobuf options, such as google.api.http describe how to expose a gRPC method through a restful endpoint:
It could be considered that a more native Sysl representation of this concept would be to include two endpoints, one gRPC and one restful, and associate them together through some means:
MyService:
MyMethod(RequestType) [~gRPC]:
return ok <: ResponseType
/my/method [proto_method = "MyMethod"]:
POST (RequestType):
return ok <: ResponseType
Whilst this approach has merit it doesn't address the problem of options in the general case. This particular example (using google.api.http) also fails to adequately address the complexity of the option itself (whereby the option can conceptually come to represent an ordered series of restful endpoints with additional configuration).
The text was updated successfully, but these errors were encountered:
andrewemeryanz
changed the title
Define Proto Custom Options in Sysl
Represent Proto Options in Sysl
Jul 16, 2021
andrewemeryanz
changed the title
Represent Proto Options in Sysl
Represention of Protobuf Options within Sysl
Jul 16, 2021
Background
Protobuf specifications support options. Options are strongly typed Protobuf values. Options are primarily found at the file level, message level and field level of a specification. There doesn't yet exist a representation of Protobuf options within a Sysl specification.
Proposal
Support the encoding of file level, service level, method level, message level and field level Protobuf options by including their Protobuf-encoded values within Sysl annotations.
Protobuf Encoding
Consider the following Protobuf example that includes various options:
Sysl Encoding
The Sysl encoding of the Protobuf options from the above specification would look like the following:
Option Mapping
Protobuf options found at the service level, method level, message level and field level map to annotations on their corresponding Sysl application, endpoint, type and field declarations respectively. Protobuf file level options are included in all Sysl applications that are defined within the Protobuf file containing these values.
Alternatives Considered
Encode Natively
Some Protobuf options, such as google.api.http describe how to expose a gRPC method through a restful endpoint:
It could be considered that a more native Sysl representation of this concept would be to include two endpoints, one gRPC and one restful, and associate them together through some means:
Whilst this approach has merit it doesn't address the problem of options in the general case. This particular example (using google.api.http) also fails to adequately address the complexity of the option itself (whereby the option can conceptually come to represent an ordered series of restful endpoints with additional configuration).
The text was updated successfully, but these errors were encountered: