Extend Protobuf/FlatBuffers Schema IDL with Shared/Circular Reference Support

Posted by chaokunyang 3 hours ago

Counter1Comment3OpenOriginal

Comments

Comment by chaokunyang 3 hours ago

If you already have .proto or .fbs schemas and you want shared/circular reference support, with the Fory compiler you can keep those schemas, add a small set of Fory options, then foryc generates idiomatic native models across Fory-supported languages

With fory first-class object graph serialziation support, you can serialize object graphs without manual *_id link reconstruction or rewriting your entire schema into Fory Schema.

1. GitHub: https://github.com/apache/fory

2. Compiler docs: https://fory.apache.org/docs/compiler

Comment by chaokunyang 3 hours ago

Flatbuffer Example:

namespace demo;

table Node {

  parent: Node (fory_weak_ref: true);

  children: [Node] (fory_ref: true);

  cached: Node (fory_ref: true, fory_thread_safe_pointer: false);

}

Comment by chaokunyang 3 hours ago

Protobuf Example:

syntax = "proto3";

message TreeNode {

  TreeNode parent = 1 [(fory).weak_ref = true];

  repeated TreeNode children = 2 [(fory).ref = true];

}