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.
| 46 | |
| 47 | @dataclasses.dataclass(frozen=True) |
| 48 | class 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) |
no outgoing calls