You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Lee Yun (Jira)" <ji...@apache.org> on 2023/05/12 08:39:00 UTC

[jira] [Updated] (THRIFT-5708) Support reflection capability like protobuf

     [ https://issues.apache.org/jira/browse/THRIFT-5708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lee Yun updated THRIFT-5708:
----------------------------
    Description: 
Hello, Thrift team. I noticed that when using Protobuf, it provides reflection capabilities that allow us to access metadata and use reflection in generated code, like this:
```

msg := pbdemo.Request\{Name: "abc"}
m := msg.ProtoReflect()
fds := m.Descriptor().Fields()
fmt.Println("----- newReflect:")
for k := 0; k < fds.Len(); k++ {
   fd := fds.Get(k)
   fmt.Println(fd)
}

 

```
I'm wondering if Thrift can also support similar functionality? For example, can Thrift record this metadata in generated code and provide reflection capabilities similar to Protobuf? This would make code development more flexible. Thank you for your attention.

  was:
Hello, Thrift team. I noticed that when using Protobuf, it provides reflection capabilities that allow us to access metadata and use reflection in generated code, like this:
clojureCopy
msg := pbdemo.Request\{Name: "abc"}
m := msg.ProtoReflect()
fds := m.Descriptor().Fields()
fmt.Println("----- newReflect:")
for k := 0; k < fds.Len(); k++ \{
    fd := fds.Get(k)
    fmt.Println(fd)
}
I'm wondering if Thrift can also support similar functionality? For example, can Thrift record this metadata in generated code and provide reflection capabilities similar to Protobuf? This would make code development more flexible. Thank you for your attention.


> Support reflection capability like protobuf
> -------------------------------------------
>
>                 Key: THRIFT-5708
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5708
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Go - Library
>            Reporter: Lee Yun
>            Priority: Major
>
> Hello, Thrift team. I noticed that when using Protobuf, it provides reflection capabilities that allow us to access metadata and use reflection in generated code, like this:
> ```
> msg := pbdemo.Request\{Name: "abc"}
> m := msg.ProtoReflect()
> fds := m.Descriptor().Fields()
> fmt.Println("----- newReflect:")
> for k := 0; k < fds.Len(); k++ {
>    fd := fds.Get(k)
>    fmt.Println(fd)
> }
>  
> ```
> I'm wondering if Thrift can also support similar functionality? For example, can Thrift record this metadata in generated code and provide reflection capabilities similar to Protobuf? This would make code development more flexible. Thank you for your attention.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)