-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Syntax rule-enforcement is inconsistent across languages #6351
Comments
This is not the bug. The common path already exists and it is checked before any codegen run: flatbuffers/src/idl_parser.cpp Lines 3032 to 3036 in 4e79d12
flatbuffers/src/idl_parser.cpp Line 2309 in 4e79d12
But this method is inaccessible because it is The
|
I understand that this is a restriction in the language, but for the first set of languages listed, the |
I'm sorry, I was wrong. A |
If the sample definition is correct, then the error being flagged by the second batch of languages is incorrect. Regardless of the language of the code being generated, it feels to me like there should be some consistency. Or a warning about using unsupported/experimental features. |
Language-feature consistency might be a nice 2.0 feature. One of the reasons flatbuffers are appealing is that they aren't language specific. But when we have mixed feature support based on language, we lose a part of that benefit. |
@zblach our upcoming "2.0" is not necessarily a big overhaul, its mostly a switch to semver, see #6353 Having all features work consistently in all language is of course something we strive for, but is a massive amount of work. It will have to be incremental. And while we're doing that, we're likely to introduce new features, which continue the problem. Implementing features for all languages at once is usually not feasible (nor desirable, the PR would be hard to review). |
I understand that, and I appreciate the move to semantic versioning. I'm not really proposing any major functionality changes, I've just been caught off-guard twice now by undocumented feature differences. |
If anything we should document this better. I'll tag this as such, maybe something for @dbaileychess, but this is not a blocker for a 2.0 release. |
This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days. |
Given the following example flatbuffer definition, I see different validation behavior depending on the language that the buffers are being generated for.
This compiles without issue for
binary
,cpp
,java
,javascript
,typescript
, andcsharp
, but fails forjson
,golang
,dart
,python
,lua
, andrust
. I didn't try other combinations, but each rejection yields the same error message --error: only tables can be union elements in the generated language: Foo
.I found this bug while attempting to validate a schema against itself as a part of a typescript project. I'd suggest fixing this issue by having a common validation path for all languages prior to codegen.
I am using
flatc
version 1.12.0 on OSX.The text was updated successfully, but these errors were encountered: