class documentation

A single field of a message type.

New usages of this message as an alternative to FieldDescriptorProto are strongly discouraged. This message does not reliability preserve all information necessary to model the schema and preserve semantics. Instead make use of FileDescriptorSet which preserves the necessary information.

Class Cardinality Whether a field is optional, required, or repeated.
Class Kind Basic field types.
Method __init__ Create a message from a source message and field values.
Method cardinality.setter Set or clear the generated cardinality field.
Method default_value.setter Set or clear the generated default_value field.
Method json_name.setter Set or clear the generated json_name field.
Method kind.setter Set or clear the generated kind field.
Method name.setter Set or clear the generated name field.
Method number.setter Set or clear the generated number field.
Method oneof_index.setter Set or clear the generated oneof_index field.
Method options.setter Set or clear the generated options field.
Method packed.setter Set or clear the generated packed field.
Method type_url.setter Set or clear the generated type_url field.
Property cardinality The field cardinality.
Property default_value The string value of the default value of this field. Proto2 syntax only.
Property json_name The field JSON name.
Property kind The field type.
Property name The field name.
Property number The field number.
Property oneof_index The index of the field type in Type.oneofs, for message or enumeration types. The first type has index 1; zero means the type is not in the list.
Property options The protocol buffer options.
Property packed Whether to use alternative packed wire representation.
Property type_url The field type URL, without the scheme, for message or enumeration types. Example: "type.googleapis.com/google.protobuf.Timestamp".

Inherited from Message:

Class Method from_json Create a message from protobuf JSON mapping.
Class Method FromString Create a message by parsing protobuf wire-format bytes.
Class Method get_descriptor Return the message descriptor from the registry.
Class Method is_credentials Return True if a Python field contains credentials.
Class Method is_sensitive Return True if a Python field has the sensitive annotation.
Method __dir__ List generated fields, oneofs, and nested declarations.
Method __repr__ Render non-default fields without disclosing annotated secrets.
Method ByteSize Return the serialized protobuf wire size in bytes.
Method check_presence Check presence using a generated Python field name.
Method Clear Clear all fields, extensions, unknown fields, and the reset mask.
Method clear_extension Clear an extension value.
Method ClearField Clear a protobuf field or oneof and record it in the reset mask.
Method CopyFrom Replace this message with an independent copy of another message.
Method FindInitializationErrors Return paths of missing required fields.
Method get_extension Return an extension value.
Method get_full_update_reset_mask Create a reset mask from the current protobuf state.
Method get_mask Return the reset mask for field changes.
Method has_extension Return True if an extension has explicit presence.
Method HasField Return True if a protobuf field or oneof has explicit presence.
Method is_default Return True if a generated field has its default value.
Method IsInitialized Return True if every required field is initialized.
Method MergeFrom Merge fields from another message of the same generated type.
Method MergeFromString Merge protobuf wire-format bytes into this message.
Method ParseFromString Parse protobuf wire-format bytes and replace this message.
Method SerializeToString Serialize the message using protobuf wire format.
Method set_extension Set an extension value.
Method set_mask Set the reset mask for this message.
Method to_json Serialize this message using protobuf JSON mapping.
Method which_field_in_oneof Return the selected Python field name for a protobuf oneof.
Method WhichOneof Return the selected protobuf field name for a oneof.
Constant __DEPRECATION_DETAILS__ Undocumented
Constant __EXTENSION_REGISTRY__ Registry that decodes protobuf extensions.
Constant __FIELDS__ Runtime field data that the generator creates.
Constant __MAX_NESTING_DEPTH__ Maximum protobuf nesting depth for serialization, parsing, and initialization checks.
Constant __PB2_DESCRIPTOR__ Alias for code that expects a protobuf descriptor.
Constant __PROTO_DESCRIPTOR__ Message descriptor from the registry.
Constant __PY_TO_PB2__ Mapping from Python names to protobuf names.
Constant __REGISTRY__ Registry for the message and its descriptor.
Class Variable __PROTO_FULL_NAME__ Fully qualified protobuf message name.
Property Extensions Provide protobuf-compatible mapping access to extension values.
Class Method _fields_by_number Undocumented
Class Method _fields_by_proto_name Undocumented
Class Method _fields_by_python_name Undocumented
Class Method _from_string Deserialize internally without invoking generated user warnings.
Class Method _oneof_python_name Undocumented
Class Method _public_fields_by_proto_name Undocumented
Class Method _public_fields_by_python_name Undocumented
Static Method _format_map_key Undocumented
Static Method _repr_field Undocumented
Method _bind_child Undocumented
Method _bind_mutation Undocumented
Method _check_same_type Undocumented
Method _child_changed Undocumented
Method _clear_state Undocumented
Method _closed_enum_unknown Undocumented
Method _converted_view Undocumented
Method _decode_map_entry Undocumented
Method _detach_child Undocumented
Method _field_has_value Undocumented
Method _field_is_default Undocumented
Method _find_initialization_errors Undocumented
Method _get_field Undocumented
Method _initialize Initialize message state, optionally suppressing generated warnings.
Method _map Undocumented
Method _merge_from_string Undocumented
Method _nesting_limit Undocumented
Method _notify Undocumented
Method _record_reset Undocumented
Method _repeated Undocumented
Method _select Undocumented
Method _serialize_to_string Undocumented
Method _set_field Undocumented
Method _suspend_mutation Undocumented
Method _suspend_reset_mask Undocumented
Method _try_decode_field Undocumented
Method _write_field Undocumented
Instance Variable _extensions Undocumented
Instance Variable _mutation_suspended Undocumented
Instance Variable _on_mutation Undocumented
Instance Variable _oneofs Undocumented
Instance Variable _present Undocumented
Instance Variable _reset_mask Undocumented
Instance Variable _reset_mask_suspended Undocumented
Instance Variable _unknown_fields Undocumented
Instance Variable _values Undocumented
Instance Variable _views Undocumented
def __init__(self, initial_message: SerializableMessage | None = None, *, kind: Kind | None | UnsetType = ..., cardinality: Cardinality | None | UnsetType = ..., number: int | None | UnsetType = ..., name: str | None | UnsetType = ..., type_url: str | None | UnsetType = ..., oneof_index: int | None | UnsetType = ..., packed: bool | None | UnsetType = ..., options: Iterable[Option] | None | UnsetType = ..., json_name: str | None | UnsetType = ..., default_value: str | None | UnsetType = ...): (source)

Create a message from a source message and field values.

@cardinality.setter
def cardinality(self, value: Cardinality | None): (source)

Set or clear the generated cardinality field.

@default_value.setter
def default_value(self, value: str | None): (source)

Set or clear the generated default_value field.

@json_name.setter
def json_name(self, value: str | None): (source)

Set or clear the generated json_name field.

@kind.setter
def kind(self, value: Kind | None): (source)

Set or clear the generated kind field.

@name.setter
def name(self, value: str | None): (source)

Set or clear the generated name field.

@number.setter
def number(self, value: int | None): (source)

Set or clear the generated number field.

@oneof_index.setter
def oneof_index(self, value: int | None): (source)

Set or clear the generated oneof_index field.

@options.setter
def options(self, value: Iterable[Option] | None): (source)

Set or clear the generated options field.

@packed.setter
def packed(self, value: bool | None): (source)

Set or clear the generated packed field.

@type_url.setter
def type_url(self, value: str | None): (source)

Set or clear the generated type_url field.

The field cardinality.

@property
default_value: str = (source)

The string value of the default value of this field. Proto2 syntax only.

The field JSON name.

The field type.

The field name.

The field number.

@property
oneof_index: int = (source)

The index of the field type in Type.oneofs, for message or enumeration types. The first type has index 1; zero means the type is not in the list.

The protocol buffer options.

Whether to use alternative packed wire representation.

The field type URL, without the scheme, for message or enumeration types. Example: "type.googleapis.com/google.protobuf.Timestamp".