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
EDIT: I was able to resolve this by finding the allow_repeated_fields_in_body=true plugin option. However, I suggest changing that option default from false to true.
I would like the openapiv2 and grpc-gateway plugins to support mapping an HTTP response to a repeated field, so that we can have array-type response bodies.
For example, I want my response body to look like:
Failure: plugin openapiv2: repeated field not allowed in field path: pets in pets
Failure: plugin grpc-gateway: repeated field not allowed in field path: pets in pets
I read the previous discussion in #317; however there are situations where you need an array-type response body, like when you are implementing an existing REST API spec while migrating a codebase to gRPC.
If an API needs to use a JSON array for request or response body, it can map
the request or response body to a repeated field. However, some gRPC
Transcoding implementations may not support this feature.
Thank you 👐
The text was updated successfully, but these errors were encountered:
I just found the allow_repeated_fields_in_body=true plugin option on both plugins, so this resolves my issue. I suggest changing the default value from false to true, since it is not a breaking change. It adds a capability that otherwise causes the plugin to fail.
armsnyder
changed the title
Support array-type response body
Support array-type response body by default
Jul 22, 2022
Hi Adam. This is an interesting point, and I agree that it would be nice to turn this on by default. Would you be willing to contribute a flip of this option from off-by-default to on-by-default?
🚀 Feature
EDIT: I was able to resolve this by finding the
allow_repeated_fields_in_body=true
plugin option. However, I suggest changing that option default fromfalse
totrue
.I would like the openapiv2 and grpc-gateway plugins to support mapping an HTTP response to a repeated field, so that we can have array-type response bodies.For example, I want my response body to look like:Instead of:Example proto:Plugin output:I read the previous discussion in #317; however there are situations where you need an array-type response body, like when you are implementing an existing REST API spec while migrating a codebase to gRPC.The documentation for thegoogle.api.http
is clear that mapping a repeated field toresponse_body
can be supported.Thank you 👐The text was updated successfully, but these errors were encountered: