You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Duru Can Celasun (Jira)" <ji...@apache.org> on 2019/12/12 10:37:00 UTC
[jira] [Commented] (THRIFT-5046) Custom tags remove db and json
tags
[ https://issues.apache.org/jira/browse/THRIFT-5046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16994504#comment-16994504 ]
Duru Can Celasun commented on THRIFT-5046:
------------------------------------------
Turns out this is not trivial to implement. The generator would have to understand and parse the Go struct tag syntax.
> Custom tags remove db and json tags
> -----------------------------------
>
> Key: THRIFT-5046
> URL: https://issues.apache.org/jira/browse/THRIFT-5046
> Project: Thrift
> Issue Type: Improvement
> Components: Go - Compiler
> Affects Versions: 0.13.0
> Reporter: Duru Can Celasun
> Priority: Minor
>
> Given the IDL:
> {code}
> struct Example {
> 1: bool withTag (go.tag = "foo:\"bar\"")
> 2: bool withoutTag
> }
> {code}
> The generated code looks like:
> {code}
> type Example struct {
> WithTag bool `thrift:"withTag,1", foo:"bar"`
> WithoutTag bool `thrift:"withoutTag,2" db:"withoutTag" json:"withoutTag"`
> }
> {code}
> The bug is on [this line|https://github.com/apache/thrift/blob/6e023df1ded255dda00eb4c041c201e66c8d1fbc/compiler/cpp/src/thrift/generate/t_go_generator.cc#L1396] of the Go generator where any custom tag overwrites the existing db and json tags.
> Custom tags that aren't overrides should be appended instead of replacing the whole thing.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)