feat(compiler): add flatbuffers idl support#3184
Merged
chaokunyang merged 18 commits intoapache:mainfrom Jan 22, 2026
Merged
Conversation
pandalee99
approved these changes
Jan 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
Currently, Fory compiler only supports its native FDL format and Protocol Buffers. Users who have existing FlatBuffers schemas or prefer FlatBuffers IDL syntax cannot leverage Fory's high-performance serialization without manually converting their schemas. This creates friction for teams migrating from FlatBuffers to Fory or those who want to use FlatBuffers IDL as their schema definition language.
What does this PR do?
This PR adds comprehensive FlatBuffers IDL support to the Fory compiler, enabling users to define schemas using
.fbsfiles and generate serialization code through Fory's compilation pipeline.Key Features
FlatBuffers IDL Parser: Complete lexer and recursive descent parser for FlatBuffers
.fbsfilesdeprecated,priority, default valuesIR Translator: Translates FlatBuffers AST to Fory IR
struct→ Fory struct withevolving=false(fixed layout)table→ Fory struct withevolving=true(schema evolution supported)Scalar Type Mapping:
byteint8ubyteuint8shortint16ushortuint16intvarint32uintvar_uint32longvarint64ulongvar_uint64floatfloat32doublefloat64boolboolstringstring[T]list<T>Unsigned Array Support: Added cross-language unsigned array type annotations
@Uint8ArrayType,@Uint16ArrayType,@Uint32ArrayType,@Uint64ArrayType,@Int8ArrayTypeUint8Array,Uint16Array,Uint32Array,Uint64Array,Int8Arraytype hints[ubyte],[ushort],[uint],[ulong]to serialize correctly across languagesCross-Language Field ID Support: Extended fingerprint computation to include field IDs for stable cross-language type compatibility
Usage
Example
Input (FlatBuffers):
Generated (Java):
Related issues
Closes #3171
Related: #3099, #1197, #1017
Does this PR introduce any user-facing change?
fory compilecommand@Uint8ArrayType, etc.)Uint8Array, etc.)No breaking changes - all existing FDL and Protobuf workflows continue to work unchanged.
Does this PR introduce any binary protocol compatibility change?
No. The generated code uses the same Fory serialization format. The FlatBuffers support is purely a schema definition convenience - the wire format remains Fory's binary protocol, not FlatBuffers wire format.