This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new 94249c234 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
94249c234 is described below
commit 94249c234375663e27f847070d8f52782c07c519
Author: chaokunyang <[email protected]>
AuthorDate: Thu Jan 22 04:00:49 2026 +0000
🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
---
docs/compiler/flatbuffers-idl.md | 85 ++++++++++++++++++++++++++++++++++++++++
docs/compiler/generated-code.md | 5 +--
docs/compiler/index.md | 15 +++----
3 files changed, 94 insertions(+), 11 deletions(-)
diff --git a/docs/compiler/flatbuffers-idl.md b/docs/compiler/flatbuffers-idl.md
new file mode 100644
index 000000000..9f8e932be
--- /dev/null
+++ b/docs/compiler/flatbuffers-idl.md
@@ -0,0 +1,85 @@
+---
+title: FlatBuffers IDL Support
+sidebar_position: 7
+id: flatbuffers_idl
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+The Fory compiler can ingest FlatBuffers schemas (`.fbs`) and translate them
into
+Fory IR before code generation. This provides a smooth migration path when you
+already have FlatBuffers schemas but want Fory-native serialization and
codegen.
+
+## Key Differences vs FDL
+
+- **Field numbering**: FlatBuffers fields have no explicit IDs; Fory assigns
+ sequential field numbers based on declaration order.
+- **Tables vs structs**: FlatBuffers `table` maps to a Fory message with
+ `evolving=true`; `struct` maps to `evolving=false`.
+- **Default values**: Parsed for compatibility but ignored in generated Fory
+ code. Use Fory options or language defaults instead.
+- **Attributes**: Metadata in `(...)` is mapped to Fory options on types and
+ fields; FDL uses `[option=value]` inline syntax.
+- **Root type**: `root_type` is ignored because Fory does not require a root
+ message to serialize.
+- **Unions**: FlatBuffers `union` is not supported yet and raises an error.
+
+## Scalar Type Mapping
+
+| FlatBuffers | Fory Primitive |
+| ----------- | -------------- |
+| `byte` | `int8` |
+| `ubyte` | `uint8` |
+| `short` | `int16` |
+| `ushort` | `uint16` |
+| `int` | `varint32` |
+| `uint` | `var_uint32` |
+| `long` | `varint64` |
+| `ulong` | `var_uint64` |
+| `float` | `float32` |
+| `double` | `float64` |
+| `bool` | `bool` |
+| `string` | `string` |
+
+Vectors (`[T]`) map to Fory list types.
+
+## Usage
+
+Compile a FlatBuffers schema directly:
+
+```bash
+fory compile schema.fbs --lang java,python --output ./generated
+```
+
+To inspect the translated FDL for debugging:
+
+```bash
+fory compile schema.fbs --emit-fdl --emit-fdl-path ./translated
+```
+
+## Generated Code Differences
+
+FlatBuffers-generated APIs are centered around `ByteBuffer` accessors and
+builders. Fory code generation instead produces native language structures and
+registration helpers, the same as when compiling FDL:
+
+- **Java**: Plain POJOs with Fory annotations.
+- **Python**: Dataclasses with registration helpers.
+- **Go/Rust/C++**: Native structs with Fory metadata.
+
+Because Fory generates native types, the resulting APIs are different from
+FlatBuffers builder/accessor APIs, and the serialization format is Fory's
binary
+protocol rather than the FlatBuffers wire format.
diff --git a/docs/compiler/generated-code.md b/docs/compiler/generated-code.md
index dc414eb47..71d08269f 100644
--- a/docs/compiler/generated-code.md
+++ b/docs/compiler/generated-code.md
@@ -709,7 +709,6 @@ int main() {
| -------------------------- | -------------------------- |
| `#[derive(ForyObject)]` | Enables Fory serialization |
| `#[fory(nullable = true)]` | Marks field as nullable |
-| `#[tag("...")]` | Name-based registration |
| `#[repr(i32)]` | Enum representation |
### C++ Macros
@@ -757,9 +756,7 @@ f.RegisterTagType("myapp.models.Config", Config{})
**Rust:**
```rust
-#[derive(ForyObject)]
-#[tag("myapp.models.Config")]
-pub struct Config { ... }
+fory.register_by_namespace::<Config>("myapp.models", "Config")?;
```
**C++:**
diff --git a/docs/compiler/index.md b/docs/compiler/index.md
index 464a2f3df..76c64c9d1 100644
--- a/docs/compiler/index.md
+++ b/docs/compiler/index.md
@@ -141,13 +141,14 @@ data = fory.serialize(person)
## Documentation
-| Document | Description
|
-| ------------------------------------------ |
-------------------------------------------- |
-| [FDL Syntax Reference](fdl-syntax.md) | Complete language syntax and
grammar |
-| [Type System](type-system.md) | Primitive types, collections,
and type rules |
-| [Compiler Guide](compiler-guide.md) | CLI options and build
integration |
-| [Generated Code](generated-code.md) | Output format for each target
language |
-| [Protocol Buffers vs FDL](protobuf-idl.md) | Comparison with protobuf and
migration guide |
+| Document | Description
|
+| ----------------------------------------------- |
------------------------------------------------- |
+| [FDL Syntax Reference](fdl-syntax.md) | Complete language syntax
and grammar |
+| [Type System](type-system.md) | Primitive types,
collections, and type rules |
+| [Compiler Guide](compiler-guide.md) | CLI options and build
integration |
+| [Generated Code](generated-code.md) | Output format for each
target language |
+| [Protocol Buffers IDL Support](protobuf-idl.md) | Comparison with protobuf
and migration guide |
+| [FlatBuffers IDL Support](flatbuffers-idl.md) | FlatBuffers mapping rules
and codegen differences |
## Key Concepts
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]