We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in openapi json it should be:
"post": { "summary": "", "description": "", "operationId": "BizComfySvc_ComfyUploadImage", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/biz_comfyComfyUploadImageResp" } }, "default": { "description": "An unexpected error response.", "schema": { "$ref": "#/definitions/googlerpcStatus" } } }, "parameters": [ { "name": "image", "description": "", "in": "body", "type": "file", "required": true }
in protobuf method it may be:
rpc ComfyUploadImage(ComfyUploadImageReq) returns (ComfyUploadImageResp) { option (google.api.http) = { post: "/api/v1/comfy/upload/image" body: "image" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { consumes: "multipart/form-data" produces: "application/json" }; }
in response it maybe:
message ComfyUploadImageReq { int64 app_id = 1; // App ID string client_id = 2; // Client ID google.api.HttpBody image = 3 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { format: "binary" type: STRING }]; } message ComfyUploadImageResp { string name = 1; string sub_folder = 2; string type = 3; }
What's difficult:
formData
The text was updated successfully, but these errors were encountered:
For server side marshaling, add:
runtime.WithMarshalerOption("multipart/form-data", &grpcconn.UploadHTTPBodyMarshaler{ Marshaler: detaultMarshaler, }),
and
type UploadHTTPBodyMarshaler struct { runtime.Marshaler } // Unmarshal unmarshals "data" into "v". // "v" must be a pointer value. func (h *UploadHTTPBodyMarshaler) Unmarshal(data []byte, v interface{}) error { if httpBody, ok := v.(*httpbody.HttpBody); ok { httpBody.Data = data return nil } return h.Marshaler.Unmarshal(data, v) } // NewDecoder returns a Decoder which reads byte sequence from "r". func (h *UploadHTTPBodyMarshaler) NewDecoder(r io.Reader) runtime.Decoder { return runtime.DecoderFunc(func(v interface{}) error { if httpBody, ok := v.(**httpbody.HttpBody); ok { buffer, err := io.ReadAll(r) if err != nil { return err } *httpBody = new(httpbody.HttpBody) (*httpBody).Data = buffer (*httpBody).ContentType = "multipart/form-data" return nil } return h.Marshaler.NewDecoder(r).Decode(v) }) }
can well get the binary
Sorry, something went wrong.
No branches or pull requests
in openapi json it should be:
in protobuf method it may be:
in response it maybe:
What's difficult:
formData
with google.api.httpThe text was updated successfully, but these errors were encountered: