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 9b4b5c1e01 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
9b4b5c1e01 is described below
commit 9b4b5c1e011fc29c5c41c6f13673545644cd458a
Author: chaokunyang <[email protected]>
AuthorDate: Wed Jul 1 05:33:24 2026 +0000
🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
---
docs/compiler/schema-idl.md | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/docs/compiler/schema-idl.md b/docs/compiler/schema-idl.md
index 128f2fe2af..d26083e5f1 100644
--- a/docs/compiler/schema-idl.md
+++ b/docs/compiler/schema-idl.md
@@ -993,9 +993,12 @@ list_type := 'list' '<' { 'optional' | 'ref' |
scalar_encoding } field_type '
array_type := 'array' '<' array_element_type '>'
```
-`optional` before `list` applies to the collection field. `ref` is only valid
-for named message/union fields; for collection contents, use `list<ref T>` or
-`map<K, ref V>`. `repeated` is accepted as an alias for `list`.
+`optional` before `list` applies to the collection field. `optional` is not
+supported when it is applied directly to `any`; use `any`, `list<any>`, or
+`map<K, any>` instead of `optional any`, `list<optional any>`, or
+`map<K, optional any>`. `ref` is only valid for named message/union fields; for
+collection contents, use `list<ref T>` or `map<K, ref V>`. `repeated` is
+accepted as an alias for `list`.
### Field Modifiers
@@ -1010,6 +1013,10 @@ message User {
}
```
+Do not use `optional` or `[nullable = true]` directly on `any`. The compiler
+rejects `optional any`, `any [nullable = true]`, `list<optional any>`, and
+`map<K, optional any>`; use `any`, `list<any>`, or `map<K, any>` instead.
+
**Generated Code:**
| Language | Non-optional | Optional
|
@@ -1389,6 +1396,9 @@ message Envelope [id=122] {
**Notes:**
- `any` always writes a null flag (same as `nullable`) because values may be
empty.
+- `optional` and `[nullable = true]` are not supported directly on `any`; use
+ `any`, `list<any>`, or `map<K, any>` instead of `optional any`,
+ `list<optional any>`, or `map<K, optional any>`.
- Allowed dynamic values are limited to `bool`, `string`, `enum`, `message`,
and `union`.
Other primitives (numeric, bytes, date/time) and list/map are not supported;
wrap them in a
message or use explicit fields instead.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]