MCPcopy
hub / github.com/danielgtaylor/python-betterproto / FieldMetadata

Class FieldMetadata

src/betterproto/__init__.py:176–195  ·  view source on GitHub ↗

Stores internal metadata used for parsing & serialization.

Source from the content-addressed store, hash-verified

174
175@dataclasses.dataclass(frozen=True)
176class FieldMetadata:
177 """Stores internal metadata used for parsing & serialization."""
178
179 # Protobuf field number
180 number: int
181 # Protobuf type name
182 proto_type: str
183 # Map information if the proto_type is a map
184 map_types: Optional[Tuple[str, str]] = None
185 # Groups several "one-of" fields together
186 group: Optional[str] = None
187 # Describes the wrapped type (e.g. when using google.protobuf.BoolValue)
188 wraps: Optional[str] = None
189 # Is the field optional
190 optional: Optional[bool] = False
191
192 @staticmethod
193 def get(field: dataclasses.Field) -> "FieldMetadata":
194 """Returns the field metadata for a dataclass field."""
195 return field.metadata["betterproto"]
196
197
198def dataclass_field(

Callers 1

dataclass_fieldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected