Skip to content

feat(dart): add schema evolution (TypeDef meta share) support#3333

Open
arjav1528 wants to merge 5 commits intoapache:mainfrom
arjav1528:dev-issue-3290
Open

feat(dart): add schema evolution (TypeDef meta share) support#3333
arjav1528 wants to merge 5 commits intoapache:mainfrom
arjav1528:dev-issue-3290

Conversation

@arjav1528
Copy link

Why?

When other languages serialize with schema evolution enabled (TypeDef/meta share), Dart could not decode because it did not implement the TypeDef/TypeMeta read/write flow. This blocked cross-language compatibility for evolving schemas (see #3290).

What does this PR do?

  • TypeDef / FieldDef and body parsing: Adds FieldDef and RemoteFieldType (Simple, ListSet, Map) in meta/field_def.dart; extends TypeResolverImpl to parse the full TypeDef body (field header, type info, name bytes or TAG_ID) and to use varuint32 small7 for type IDs in the body and in type meta.
  • Meta share cache and context: Read cache stores (TypeInfo, List<FieldDef>) per index; DeserializationContext gets currentRemoteFieldDefs; readTypeInfo sets it when returning from shared type meta (new or ref); resetReadContext clears cache and currentRemoteFieldDefs.
  • Compatible-struct read by remote field order: When compatible is true and currentRemoteFieldDefs is set, ClassSerializer uses _readByRemoteFieldOrder: iterates remote field defs, reads values by remote type (including nested LIST/SET/MAP), assigns to local fields by name (snake_case) or by index; supports TAG_ID for future tag-based matching.
  • Tests: Round-trip with compatible + ref; meta share cache (single marker for list element type); TypeDef format round-trip; named compatible (typename) and compatible by user type id; cross-language golden test added but skipped with a note for future integration.

Related issues

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
    No new public APIs; internal types (FieldDef, RemoteFieldType) are in src/meta and used by the resolver/serializer.
  • Does this PR introduce any binary protocol compatibility change?
    No. Dart now correctly implements the existing xlang Type Meta / TypeDef format so that Dart can decode data produced by other languages with compatible + meta share enabled.

@arjav1528 arjav1528 force-pushed the dev-issue-3290 branch 3 times, most recently from 795eb3b to b4394a4 Compare February 13, 2026 09:08
@arjav1528
Copy link
Author

@chaokunyang could you please help me with the PR tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dart] add schema evolution (TypeDef meta share) support

1 participant