-
Notifications
You must be signed in to change notification settings - Fork 247
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
Scrooge does not appear to honor Apache Thrift's list of reserved words #259
Comments
Smells like this could be an intentional choice, of course. Let me know. That said, there's little or no public documentation of Thrift's reserved words, so users aren't likely to realize they're transgressing against compatibility unless the compiler either refuses to compile or at least requires them to use some kind of "--force" flag to override compatibility. |
it'd be good if we matched apache thrift's behavior. i suspect if we didn't give users an escape valve it'd wreck havoc on them. perhaps via a "comment" to allow specific keywords within the file? |
@rklancer would you be open to making a PR that reserves the thrift reserved words? |
Problem: Scrooge [[ #259 | doesn't respect the same keywords ]] as Apache thrift. This mismatch prevents us from upgrading thrift, and it creates friction for customers generating code from existing scrooge-compatible thrift files via apache thrift. Solution: Update our forbidden keywords in ThriftParser to include [[ https://github.com/apache/thrift/blob/f7e6c654bde5d9832bede2b48b460c3e1bbbbb92/doc/specs/idl.md#reserved-keywords | the keywords ]] Apache Thrift disallows, and fix affected files. JIRA Issues: CSL-11183 Differential Revision: https://phabricator.twitter.biz/D707116
The new checks for reserved Thrift keywords introduced by 884f360: scrooge/scrooge-generator/src/main/scala/com/twitter/scrooge/frontend/ThriftParser.scala Lines 110 to 115 in a647e1d
...do not seem to be disabled by the
...just checking, was that intentional? |
Expected behavior
Apache Thrift defines a list of reserved words that apparently cannot be used as field identifiers: https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=compiler/cpp/src/thrift/thriftl.ll;hb=e1832c354391deb0e0ce94a62ff32e8ce1c83fd3#l273
Therefore, I expect Scrooge to fail to compile a .thrift file with a field named
delete
. Failing that I expect a clear warning that the thrift file may be incompatible with other Thrift implementations.Actual behavior
We have been using a Scrooge-compiled Thrift file in a production Java system for a while:
However, we are unable to use Apache Thrift's python generator to build an ops tool to observe these messages:
The text was updated successfully, but these errors were encountered: