Skip to content

Commit 89514f3

Browse files
committed
rename compatible to evolving
1 parent 7300c70 commit 89514f3

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

compiler/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ option (fory).polymorphism = true;
236236
```fdl
237237
message MyMessage {
238238
option (fory).id = 100;
239-
option (fory).compatible = true;
239+
option (fory).evolving = false;
240240
option (fory).use_record_for_java = true;
241241
string name = 1;
242242
}

compiler/extension/fory_options.proto

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// Message options:
3131
// message MyMessage {
3232
// option (fory).id = 100;
33-
// option (fory).compatible = true;
33+
// option (fory).evolving = false;
3434
// option (fory).use_record_for_java = true;
3535
// }
3636
//
@@ -83,10 +83,10 @@ message ForyMessageOptions {
8383
// If not specified, namespace-based registration is used.
8484
optional int32 id = 1;
8585

86-
// Enable schema compatibility mode for this message.
87-
// When true, fields can be added/removed without breaking compatibility.
88-
// Default: false (strict schema matching)
89-
optional bool compatible = 2;
86+
// Enable schema evolution for this message.
87+
// When true (default), fields can be added/removed with forward/backward compatibility.
88+
// When false, schema is fixed like a struct - no changes allowed, better performance.
89+
optional bool evolving = 2;
9090

9191
// Generate a Java record instead of a class for this specific message.
9292
// Overrides file-level use_record_for_java_message setting.

compiler/fory_compiler/parser/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
# Known Fory message-level options (option statements inside message body)
6969
KNOWN_FORY_MESSAGE_OPTIONS: Set[str] = {
7070
"id",
71-
"compatible",
71+
"evolving",
7272
"use_record_for_java",
7373
"deprecated",
7474
"namespace",

compiler/tests/test_package_options.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ def test_message_level_fory_option(self):
11051105
package myapp;
11061106
message User {
11071107
option (fory).id = 100;
1108-
option (fory).compatible = true;
1108+
option (fory).evolving = false;
11091109
string name = 1;
11101110
}
11111111
'''
@@ -1116,7 +1116,7 @@ def test_message_level_fory_option(self):
11161116
user = schema.messages[0]
11171117
assert user.type_id == 100 # fory.id should set type_id
11181118
assert user.options.get("fory.id") == 100
1119-
assert user.options.get("fory.compatible") is True
1119+
assert user.options.get("fory.evolving") is False
11201120

11211121
def test_message_fory_id_sets_type_id(self):
11221122
"""Test that option (fory).id sets message type_id."""
@@ -1315,11 +1315,11 @@ def test_unknown_extension_warns(self):
13151315
assert "ignoring unknown extension 'custom'" in str(w[0].message)
13161316

13171317
def test_inline_and_body_options_merge(self):
1318-
"""Test that inline [id=100] and body option (fory).compatible merge."""
1318+
"""Test that inline [id=100] and body option (fory).evolving merge."""
13191319
source = '''
13201320
package myapp;
13211321
message User [id=100] {
1322-
option (fory).compatible = true;
1322+
option (fory).evolving = false;
13231323
string name = 1;
13241324
}
13251325
'''
@@ -1330,7 +1330,7 @@ def test_inline_and_body_options_merge(self):
13301330
user = schema.messages[0]
13311331
assert user.type_id == 100 # From inline option
13321332
assert user.options.get("id") == 100 # Stored in options
1333-
assert user.options.get("fory.compatible") is True # From body option
1333+
assert user.options.get("fory.evolving") is False # From body option
13341334

13351335
def test_body_option_overrides_inline_id(self):
13361336
"""Test that body option (fory).id overrides inline [id=...]."""

docs/schema/fdl-syntax.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ Options can be specified inside the message body:
10101010
```fdl
10111011
message MyMessage {
10121012
option (fory).id = 100;
1013-
option (fory).compatible = true;
1013+
option (fory).evolving = false;
10141014
option (fory).use_record_for_java = true;
10151015
string name = 1;
10161016
}
@@ -1019,7 +1019,7 @@ message MyMessage {
10191019
| Option | Type | Description |
10201020
| --------------------- | ------ | ------------------------------------------ |
10211021
| `id` | int | Type ID for serialization (sets type_id) |
1022-
| `compatible` | bool | Enable schema compatibility mode |
1022+
| `evolving` | bool | Schema evolution support (default: true). When false, schema is fixed like a struct |
10231023
| `use_record_for_java` | bool | Generate Java record for this message |
10241024
| `deprecated` | bool | Mark this message as deprecated |
10251025
| `namespace` | string | Custom namespace for type registration |
@@ -1069,7 +1069,7 @@ You can combine standard options with Fory extension options:
10691069
```fdl
10701070
message User {
10711071
option deprecated = true; // Standard option
1072-
option (fory).compatible = true; // Fory extension option
1072+
option (fory).evolving = false; // Fory extension option
10731073
10741074
string name = 1;
10751075
MyType data = 2 [deprecated = true, (fory).ref = true];
@@ -1098,7 +1098,7 @@ extend google.protobuf.MessageOptions {
10981098
10991099
message ForyMessageOptions {
11001100
optional int32 id = 1;
1101-
optional bool compatible = 2;
1101+
optional bool evolving = 2;
11021102
optional bool use_record_for_java = 3;
11031103
optional bool deprecated = 4;
11041104
optional string namespace = 5;

0 commit comments

Comments
 (0)