Parsing from proto should keep field ID. (fixes #7645)
Fix issue #7645. When parsing from a proto that have explicit field identifiers, flatbuffers need to keep those identifiers stable by explicitly using the id attribute. This is because protos allow new field placement anywhere in their message, even before other fields, as long as they use a new field ID.
Under construction ...
@dbaileychess could you please help me with review this ?
Hello @dbaileychess , I found in parser for union add a second auto-generated vector field to hold the types, with a special suffix. The generated field will get id equal to union id minus 1 : Link I wonder if this is a correct behavior for parser or not ? Is this documented ? Actually, It violates consecutive invariant id rules. because it force fbs writer to reserve an id before union id . You can find In monster tests that we do not use id 7, because union wants to use it, And if we use this id, It wont generate code
Hello @dbaileychess , I found in parser for union add a second auto-generated vector field to hold the types, with a special suffix. The generated field will get id equal to union id minus 1 : Link I wonder if this is a correct behavior for parser or not ? Is this documented ? Actually, It violates consecutive invariant id rules. because it force fbs writer to reserve an id before union id . You can find In monster tests that we do not use id 7, because union wants to use it, And if we use this id, It wont generate code
See https://le-michael.github.io/flatbuffers-doc-demo/Schemas.html#attributes on id. We do mention that Unions have two fields associated with them, the Union value N and an implicit hidden Union-Type N-1.
Hello @dbaileychess
- Can you help me with buildifier check
- What should I do about --conform ? What is final decision about it ?
- It seems ready to review. Could you please review it ?
@enum-class Let me get back to you on this.
For conform, lets just output a message (warning level) that when you use --proto, that you should check for conformity yourself, using the existing --conform implementation.
The builtkite isn't a build cleaner, but another CI platform for bazel. The error looks temporary to me, so lets just try retriggering it.
Oops, you meant the buildifer within builtkite. That can be fixed automatically with the following command:
buildifier tests/BUILD.bazel
Looks like you need to alphabetize the entries, if you don't want to download buildifer
Thank you for your time, Great review, I love it
@dbaileychess Could please help me with review this p.r.
@dbaileychess This tiny p.r. from last year needs review :)
@enum-class Sorry for missing this, I will get to it today or tomorrow.
Going to approve this now. Since it is a new feature, we can fix forward any issues.