MCPcopy Create free account
hub / github.com/apache/fory / ForyFieldMeta

Class ForyFieldMeta

python/pyfory/field.py:48–71  ·  view source on GitHub ↗

Fory field metadata extracted from field.metadata. Attributes: id: Field tag ID. -1 is the internal sentinel for no configured ID; >=0 means use tag ID. nullable: Whether null flag is written. Default False. ref: Whether reference tracking is enabled for this field.

Source from the content-addressed store, hash-verified

46
47@dataclasses.dataclass(frozen=True)
48class ForyFieldMeta:
49 """
50 Fory field metadata extracted from field.metadata.
51
52 Attributes:
53 id: Field tag ID. -1 is the internal sentinel for no configured ID; >=0 means use tag ID.
54 nullable: Whether null flag is written. Default False.
55 ref: Whether reference tracking is enabled for this field. Default False.
56 ignore: Whether to ignore this field during serialization. Default False.
57 dynamic: Whether type info is written for this field. None means auto-detect.
58 - None (default): Auto-detect based on type (abstract=True, concrete=mode-dependent)
59 - True: Always write type info (support runtime subtypes)
60 - False: Never write type info (use declared type's serializer)
61 """
62
63 id: int
64 nullable: bool = False
65 ref: bool = False
66 ignore: bool = False
67 dynamic: Optional[bool] = None
68
69 def uses_tag_id(self) -> bool:
70 """Returns True if this field uses tag ID encoding (id >= 0)."""
71 return self.id >= 0
72
73
74@dataclasses.dataclass(frozen=True)

Callers 4

_default_field_metaFunction · 0.90
test_uses_tag_idMethod · 0.90
test_default_valuesMethod · 0.90
fieldFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_uses_tag_idMethod · 0.72
test_default_valuesMethod · 0.72