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
While designing a Protobuf API taking into consideration Javascript consumers we need to mind that the generated js client will make use of define endpoints on the protobuf file. As a way of easing development and not having the overhead of writing new Encoder / Decoders and leveraging the use of reflection, requests that make use of the JS generated client MUST be defined as POST.
This is due to RPC and REST are different API design, and as we're designing for RPC and not Restful endpoints, our generated swagger client needs to be aware of this design choice and not get into the nitty-gritty of understanding REST routes, but only Marshal / Unmarshal JSON on the request body.
This design choice was made taking into consideration the HTTP Spec, which recommends GET requests not to contain a body and Swagger enforces this:
GET, DELETE and HEAD are no longer allowed to have request body because it does not have defined semantics as per RFC 7231.
This causes our generation to panic on GET requests.
Root causes: JS clients does not currently support gRPC (at the moment of this writing).
The text was updated successfully, but these errors were encountered:
The paths for the generated http post endpoints have the primary requirement to be unique, secondary requirement to be developer friendly. They do not have the requirement to adhere RESTful design.
We decided to go with paths like shown in the following example. The generated http endpoints will never be visible for developers, as they are internally used in the generated JavaScript client. For debugging purposes it might still be useful to have human readable paths.
One drawback of this is, that the returned status codes have to be handled and will probably not be what a developer would expect. E.g. a successful get request in the above style would not return http 200, but http 201.
While designing a Protobuf API taking into consideration Javascript consumers we need to mind that the generated js client will make use of define endpoints on the protobuf file. As a way of easing development and not having the overhead of writing new Encoder / Decoders and leveraging the use of reflection, requests that make use of the JS generated client MUST be defined as
POST
.This is due to RPC and REST are different API design, and as we're designing for RPC and not Restful endpoints, our generated swagger client needs to be aware of this design choice and not get into the nitty-gritty of understanding REST routes, but only Marshal / Unmarshal JSON on the request body.
This design choice was made taking into consideration the HTTP Spec, which recommends
GET
requests not to contain a body and Swagger enforces this:This causes our generation to panic on
GET
requests.Root causes: JS clients does not currently support gRPC (at the moment of this writing).
The text was updated successfully, but these errors were encountered: