Comments (3)
What you're talking about is the proper JSON representation of the google.protobuf.Any
type: https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/any.proto#L101-L126. Perhaps you want to use something else?
from grpc-gateway.
What you're talking about is the proper JSON representation of the
google.protobuf.Any
type: https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/any.proto#L101-L126. Perhaps you want to use something else?
In order to return a unified response body, define a messge type and Custom Marshaler ๏ผ
![image](https://private-user-images.githubusercontent.com/13195119/329436175-5e8ee183-def1-4696-93f9-2e5790987769.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc0NDk0MzMsIm5iZiI6MTcxNzQ0OTEzMywicGF0aCI6Ii8xMzE5NTExOS8zMjk0MzYxNzUtNWU4ZWUxODMtZGVmMS00Njk2LTkzZjktMmU1NzkwOTg3NzY5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjAzVDIxMTIxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVhNDY3MjMwMGFlYjljZGVkNTdlZWE1ZDVlODY0ZGQ0YTE4ZWZiM2Q3NjZhNmEyNDQyODY0MWI3NzBhMjA5ZGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.IsSndEIz75CWWwsMo0qoGWnTEUfSeezrA_GE7-x0uZA)
Because of google.protobuf.Any
๏ผThe response json will have @type.
I want to remove @type, how can I do it ?
from grpc-gateway.
I see you have a custom marshaler already - you can control exactly what the format is right there.
I strongly suggest not using google.protobuf.Any for responses though. You're losing many of the benefits of protobuf.
I'm going to close this as this is not a support forum for Go and there's nothing the gateway can do about this.
from grpc-gateway.
Related Issues (20)
- Adding custom mux endpoint to openapi output HOT 3
- The API Gateway Vision HOT 2
- Support disabling default response rendering in bazel rule HOT 1
- Example and pattern annotations are not respect for query and path parameters HOT 8
- FieldMask as query param is not converted to snake case HOT 1
- an google.protobuf.Any type how to get openapiv2 output? HOT 1
- omit-enum-default-value Generates Invalid Spec for Enums with a Single Value HOT 1
- Content-Length not set in ForwardResponseMessage HOT 5
- Log level for errors is "info" HOT 5
- On `context deadline exceeded`, response headers aren't set HOT 3
- Add support for Etag & If-None-Match headers HOT 6
- TestOutgoingTrailerMatcher is non-deterministic
- Feat: add http handler middleware HOT 1
- `X-Forwarded-For` header is not handled correctly HOT 2
- README.md: link to Wiki of "tool dependency" has been moved to go.dev HOT 1
- undefined: grpc.NewClient HOT 1
- proposal: Use version info from runtime/debug:BuildInfo when installed by go install HOT 2
- OpenAPI gen doesn't work default mapping. HOT 1
- buf: failed to read gRPC API Configuration description: no such file or directory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-gateway.