New issue
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
gen/enum: Support periods in item names #407
Conversation
Hello! Thanks for your contribution! Before we can review this, please,
|
@abhinav can you please have a look now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Thank you!
CC @kriskowal @mh-park if you wouldn't mind taking a look as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just realized that this isn't something that Apache Thrift
supports. Introducing this change will encourage Thrift files that work with
ThriftRW but not with Apache Thrift.
$ cat > tmp.thrift
enum X { foo.bar, baz }
$ thrift --gen py tmp.thrift
[ERROR:/Users/abg/tmp/tmp.thrift:1] (last token was ',')
Identifier foo.bar can't have a dot.
$ thrift --gen go tmp.thrift
[ERROR:/Users/abg/tmp/tmp.thrift:1] (last token was ',')
Identifier foo.bar can't have a dot.
Can you add some background about your use case so that we can weigh the
potential issues associated with this change and possible solutions?
@abhinav its because RTAPI thrift files use them. |
@ramprasadg We’ve had many conversations over the years about RTAPI’s enums. The road for RTAPI IDL to be welcomed into the fold of IDL that can cross-compile is to move the dot delimited name into an annotation and change the name to an identifier that will compile in other languages. This is important especially since Eats services in particular use RTAPI to translate JSON to TBinary for Go services, so the IDL needs to compile for both. I was under the impression that there was an effort in progress to convert enum names to annotations. |
@kriskowal do you know who would be the right people to contact? |
We decided against this after all. |
This adds support for enum items with periods in their names.
Previously, the following enum would parse successfully but generate
invalid Go code.
With this change,
foo.bar
is treated similarly tofoo_bar
.