proto嵌套结构无法绑定到http。

huangapple go评论118阅读模式
英文:

The proto nested structure cannot be bound to http

问题

当kratos proto文件在结构嵌套时使用http接口时,无法将参数分配给结构体。

这是我的proto文件:链接

这是我的请求:链接

这是我的调试信息:链接

我希望像这样实现:

  1. pb.ListUserRequest{
  2. Page: {
  3. Index: 1,
  4. Size: 10,
  5. },
  6. }

没有绑定参数,我该怎么办?

英文:

When the kratos proto file uses the http interface when the structure is nested, the parameter assignment cannot go to the structure

This`s my proto file

This`s my request

This`s my debug

I want like this:

  1. pb.ListUserRequest{
  2. Page: {
  3. Index: 1,
  4. Size: 10,
  5. },
  6. }

There is no binding parameter
what should i do

答案1

得分: 0

http无法通过'GET'解码内部对象

  1. 使用'POST'
  1. option (google.api.http) = {
  2. put: "/user/v1/list"
  3. body: "*"
  4. };

proto:

  1. message ListUserRequest {
  2. Page page = 1;
  3. }
  1. 不使用内部对象
    proto:
  1. message ListUserRequest {
  2. int32 index = 1;
  3. int32 size = 2;
  4. }
英文:

http can't decode inner_object by 'GET'

  1. use 'POST'
  1. option (google.api.http) = {
  2. put: "/user/v1/list"
  3. body: "*"
  4. };

proto:

  1. message ListUserRequest {
  2. Page page = 1;
  3. }

2.not use inner_object
proto:

  1. message ListUserRequest {
  2. int32 index = 1;
  3. int32 size = 2;
  4. }

huangapple
  • 本文由 发表于 2022年11月18日 14:46:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/74485829.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定