Skip to content

Instantly share code, notes, and snippets.

@devoncarew
Created January 28, 2025 18:03
Show Gist options
  • Save devoncarew/58c465bfc6807687105cb147c24cb115 to your computer and use it in GitHub Desktop.
Save devoncarew/58c465bfc6807687105cb147c24cb115 to your computer and use it in GitHub Desktop.
// Generated from google/protobuf/descriptor.proto.
//
// Package 'google.protobuf'.
// ignore_for_file: constant_identifier_names
import 'dart:typed_data';
import 'package:fixnum/fixnum.dart';
import 'package:protolino/protolino.dart';
/// The protocol compiler can output a FileDescriptorSet containing the .proto
/// files it parses.
class FileDescriptorSet extends ProtoMessage {
FileDescriptorSet({List<FileDescriptorProto>? file}) {
if (file != null) $values[$fields.file] = file;
}
static final $fields = (file: ProtoField<FileDescriptorProto>(1, 'file'));
List<FileDescriptorProto> get file => $value($fields.file);
}
/// Describes a complete .proto file.
class FileDescriptorProto extends ProtoMessage {
FileDescriptorProto({
String? name,
String? package,
List<String>? dependency,
List<int>? publicDependency,
List<int>? weakDependency,
List<DescriptorProto>? messageType,
List<EnumDescriptorProto>? enumType,
List<ServiceDescriptorProto>? service,
List<FieldDescriptorProto>? extension,
FileOptions? options,
SourceCodeInfo? sourceCodeInfo,
String? syntax,
Edition? edition,
}) {
if (name != null) $values[$fields.name] = name;
if (package != null) $values[$fields.package] = package;
if (dependency != null) $values[$fields.dependency] = dependency;
if (publicDependency != null) {
$values[$fields.publicDependency] = publicDependency;
}
if (weakDependency != null) {
$values[$fields.weakDependency] = weakDependency;
}
if (messageType != null) $values[$fields.messageType] = messageType;
if (enumType != null) $values[$fields.enumType] = enumType;
if (service != null) $values[$fields.service] = service;
if (extension != null) $values[$fields.extension] = extension;
if (options != null) $values[$fields.options] = options;
if (sourceCodeInfo != null) {
$values[$fields.sourceCodeInfo] = sourceCodeInfo;
}
if (syntax != null) $values[$fields.syntax] = syntax;
if (edition != null) $values[$fields.edition] = edition;
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
package: ProtoField<String>(2, 'package', ''),
dependency: ProtoField<String>(3, 'dependency', ''),
publicDependency: ProtoField<int>(10, 'public_dependency', 0),
weakDependency: ProtoField<int>(11, 'weak_dependency', 0),
messageType: ProtoField<DescriptorProto>(4, 'message_type'),
enumType: ProtoField<EnumDescriptorProto>(5, 'enum_type'),
service: ProtoField<ServiceDescriptorProto>(6, 'service'),
extension: ProtoField<FieldDescriptorProto>(7, 'extension'),
options: ProtoField<FileOptions>(8, 'options'),
sourceCodeInfo: ProtoField<SourceCodeInfo>(9, 'source_code_info'),
syntax: ProtoField<String>(12, 'syntax', ''),
edition: ProtoField<Edition>(14, 'edition', Edition.EDITION_UNKNOWN),
);
String get name => $value($fields.name);
String get package => $value($fields.package);
/// Names of files imported by this file.
List<String> get dependency => $value($fields.dependency);
/// Indexes of the public imported files in the dependency list above.
List<int> get publicDependency => $value($fields.publicDependency);
/// Indexes of the weak imported files in the dependency list.
/// For Google-internal migration only. Do not use.
List<int> get weakDependency => $value($fields.weakDependency);
/// All top-level definitions in this file.
List<DescriptorProto> get messageType => $value($fields.messageType);
List<EnumDescriptorProto> get enumType => $value($fields.enumType);
List<ServiceDescriptorProto> get service => $value($fields.service);
List<FieldDescriptorProto> get extension => $value($fields.extension);
FileOptions? get options => $value($fields.options);
/// This field contains optional information about the original source code.
/// You may safely remove this entire field without harming runtime
/// functionality of the descriptors -- the information is needed only by
/// development tools.
SourceCodeInfo? get sourceCodeInfo => $value($fields.sourceCodeInfo);
/// The syntax of the proto file.
/// The supported values are "proto2", "proto3", and "editions".
///
/// If `edition` is present, this value must be "editions".
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
String get syntax => $value($fields.syntax);
/// The edition of the proto file.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
Edition get edition => $value($fields.edition);
}
/// Describes a message type.
class DescriptorProto extends ProtoMessage {
DescriptorProto({
String? name,
List<FieldDescriptorProto>? field,
List<FieldDescriptorProto>? extension,
List<DescriptorProto>? nestedType,
List<EnumDescriptorProto>? enumType,
List<DescriptorProto$ExtensionRange>? extensionRange,
List<OneofDescriptorProto>? oneofDecl,
MessageOptions? options,
List<DescriptorProto$ReservedRange>? reservedRange,
List<String>? reservedName,
}) {
if (name != null) $values[$fields.name] = name;
if (field != null) $values[$fields.field] = field;
if (extension != null) $values[$fields.extension] = extension;
if (nestedType != null) $values[$fields.nestedType] = nestedType;
if (enumType != null) $values[$fields.enumType] = enumType;
if (extensionRange != null) {
$values[$fields.extensionRange] = extensionRange;
}
if (oneofDecl != null) $values[$fields.oneofDecl] = oneofDecl;
if (options != null) $values[$fields.options] = options;
if (reservedRange != null) $values[$fields.reservedRange] = reservedRange;
if (reservedName != null) $values[$fields.reservedName] = reservedName;
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
field: ProtoField<FieldDescriptorProto>(2, 'field'),
extension: ProtoField<FieldDescriptorProto>(6, 'extension'),
nestedType: ProtoField<DescriptorProto>(3, 'nested_type'),
enumType: ProtoField<EnumDescriptorProto>(4, 'enum_type'),
extensionRange: ProtoField<DescriptorProto$ExtensionRange>(
5,
'extension_range',
),
oneofDecl: ProtoField<OneofDescriptorProto>(8, 'oneof_decl'),
options: ProtoField<MessageOptions>(7, 'options'),
reservedRange: ProtoField<DescriptorProto$ReservedRange>(
9,
'reserved_range',
),
reservedName: ProtoField<String>(10, 'reserved_name', ''),
);
String get name => $value($fields.name);
List<FieldDescriptorProto> get field => $value($fields.field);
List<FieldDescriptorProto> get extension => $value($fields.extension);
List<DescriptorProto> get nestedType => $value($fields.nestedType);
List<EnumDescriptorProto> get enumType => $value($fields.enumType);
List<DescriptorProto$ExtensionRange> get extensionRange =>
$value($fields.extensionRange);
List<OneofDescriptorProto> get oneofDecl => $value($fields.oneofDecl);
MessageOptions? get options => $value($fields.options);
List<DescriptorProto$ReservedRange> get reservedRange =>
$value($fields.reservedRange);
/// Reserved field names, which may not be used by fields in the same message.
/// A given name may only be reserved once.
List<String> get reservedName => $value($fields.reservedName);
}
class DescriptorProto$ExtensionRange extends ProtoMessage {
DescriptorProto$ExtensionRange({
int? start,
int? end,
ExtensionRangeOptions? options,
}) {
if (start != null) $values[$fields.start] = start;
if (end != null) $values[$fields.end] = end;
if (options != null) $values[$fields.options] = options;
}
static final $fields = (
start: ProtoField<int>(1, 'start', 0),
end: ProtoField<int>(2, 'end', 0),
options: ProtoField<ExtensionRangeOptions>(3, 'options'),
);
int get start => $value($fields.start);
int get end => $value($fields.end);
ExtensionRangeOptions? get options => $value($fields.options);
}
/// Range of reserved tag numbers. Reserved tag numbers may not be used by
/// fields or extension ranges in the same message. Reserved ranges may
/// not overlap.
class DescriptorProto$ReservedRange extends ProtoMessage {
DescriptorProto$ReservedRange({int? start, int? end}) {
if (start != null) $values[$fields.start] = start;
if (end != null) $values[$fields.end] = end;
}
static final $fields = (
start: ProtoField<int>(1, 'start', 0),
end: ProtoField<int>(2, 'end', 0),
);
int get start => $value($fields.start);
int get end => $value($fields.end);
}
class ExtensionRangeOptions extends ProtoMessage {
ExtensionRangeOptions({
List<UninterpretedOption>? uninterpretedOption,
List<ExtensionRangeOptions$Declaration>? declaration,
FeatureSet? features,
ExtensionRangeOptions$VerificationState? verification,
}) {
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
if (declaration != null) $values[$fields.declaration] = declaration;
if (features != null) $values[$fields.features] = features;
if (verification != null) $values[$fields.verification] = verification;
}
static final $fields = (
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
declaration: ProtoField<ExtensionRangeOptions$Declaration>(
2,
'declaration',
),
features: ProtoField<FeatureSet>(50, 'features'),
verification: ProtoField<ExtensionRangeOptions$VerificationState>(
3,
'verification',
ExtensionRangeOptions$VerificationState.DECLARATION,
),
);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
/// For external users: DO NOT USE. We are in the process of open sourcing
/// extension declaration and executing internal cleanups before it can be
/// used externally.
List<ExtensionRangeOptions$Declaration> get declaration =>
$value($fields.declaration);
/// Any features defined in the specific edition.
FeatureSet? get features => $value($fields.features);
/// The verification state of the range.
/// TODO: flip the default to DECLARATION once all empty ranges
/// are marked as UNVERIFIED.
ExtensionRangeOptions$VerificationState get verification =>
$value($fields.verification);
}
class ExtensionRangeOptions$Declaration extends ProtoMessage {
ExtensionRangeOptions$Declaration({
int? number,
String? fullName,
String? type,
bool? reserved,
bool? repeated,
}) {
if (number != null) $values[$fields.number] = number;
if (fullName != null) $values[$fields.fullName] = fullName;
if (type != null) $values[$fields.type] = type;
if (reserved != null) $values[$fields.reserved] = reserved;
if (repeated != null) $values[$fields.repeated] = repeated;
}
static final $fields = (
number: ProtoField<int>(1, 'number', 0),
fullName: ProtoField<String>(2, 'full_name', ''),
type: ProtoField<String>(3, 'type', ''),
reserved: ProtoField<bool>(5, 'reserved', false),
repeated: ProtoField<bool>(6, 'repeated', false),
);
/// The extension number declared within the extension range.
int get number => $value($fields.number);
/// The fully-qualified name of the extension field. There must be a leading
/// dot in front of the full name.
String get fullName => $value($fields.fullName);
/// The fully-qualified type name of the extension field. Unlike
/// Metadata.type, Declaration.type must have a leading dot for messages
/// and enums.
String get type => $value($fields.type);
/// If true, indicates that the number is reserved in the extension range,
/// and any extension field with the number will fail to compile. Set this
/// when a declared extension field is deleted.
bool get reserved => $value($fields.reserved);
/// If true, indicates that the extension must be defined as repeated.
/// Otherwise the extension must be defined as optional.
bool get repeated => $value($fields.repeated);
}
/// The verification state of the extension range.
class ExtensionRangeOptions$VerificationState extends ProtoEnum {
const ExtensionRangeOptions$VerificationState(super.$value, super.name);
static const List<ExtensionRangeOptions$VerificationState> values = [
DECLARATION,
UNVERIFIED,
];
/// All the extensions of the range must be declared.
static const DECLARATION = ExtensionRangeOptions$VerificationState(
0,
'DECLARATION',
);
static const UNVERIFIED = ExtensionRangeOptions$VerificationState(
1,
'UNVERIFIED',
);
}
/// Describes a field within a message.
class FieldDescriptorProto extends ProtoMessage {
FieldDescriptorProto({
String? name,
int? number,
FieldDescriptorProto$Label? label,
FieldDescriptorProto$Type? type,
String? typeName,
String? extendee,
String? defaultValue,
int? oneofIndex,
String? jsonName,
FieldOptions? options,
bool? proto3Optional,
}) {
if (name != null) $values[$fields.name] = name;
if (number != null) $values[$fields.number] = number;
if (label != null) $values[$fields.label] = label;
if (type != null) $values[$fields.type] = type;
if (typeName != null) $values[$fields.typeName] = typeName;
if (extendee != null) $values[$fields.extendee] = extendee;
if (defaultValue != null) $values[$fields.defaultValue] = defaultValue;
if (oneofIndex != null) $values[$fields.oneofIndex] = oneofIndex;
if (jsonName != null) $values[$fields.jsonName] = jsonName;
if (options != null) $values[$fields.options] = options;
if (proto3Optional != null) {
$values[$fields.proto3Optional] = proto3Optional;
}
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
number: ProtoField<int>(3, 'number', 0),
label: ProtoField<FieldDescriptorProto$Label>(
4,
'label',
FieldDescriptorProto$Label.LABEL_OPTIONAL,
),
type: ProtoField<FieldDescriptorProto$Type>(
5,
'type',
FieldDescriptorProto$Type.TYPE_DOUBLE,
),
typeName: ProtoField<String>(6, 'type_name', ''),
extendee: ProtoField<String>(2, 'extendee', ''),
defaultValue: ProtoField<String>(7, 'default_value', ''),
oneofIndex: ProtoField<int>(9, 'oneof_index', 0),
jsonName: ProtoField<String>(10, 'json_name', ''),
options: ProtoField<FieldOptions>(8, 'options'),
proto3Optional: ProtoField<bool>(17, 'proto3_optional', false),
);
String get name => $value($fields.name);
int get number => $value($fields.number);
FieldDescriptorProto$Label get label => $value($fields.label);
/// If type_name is set, this need not be set. If both this and type_name
/// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
FieldDescriptorProto$Type get type => $value($fields.type);
/// For message and enum types, this is the name of the type. If the name
/// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
/// rules are used to find the type (i.e. first the nested types within this
/// message are searched, then within the parent, on up to the root
/// namespace).
String get typeName => $value($fields.typeName);
/// For extensions, this is the name of the type being extended. It is
/// resolved in the same manner as type_name.
String get extendee => $value($fields.extendee);
/// For numeric types, contains the original text representation of the value.
/// For booleans, "true" or "false".
/// For strings, contains the default text contents (not escaped in any way).
/// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
String get defaultValue => $value($fields.defaultValue);
/// If set, gives the index of a oneof in the containing type's oneof_decl
/// list. This field is a member of that oneof.
int get oneofIndex => $value($fields.oneofIndex);
/// JSON name of this field. The value is set by protocol compiler. If the
/// user has set a "json_name" option on this field, that option's value
/// will be used. Otherwise, it's deduced from the field's name by converting
/// it to camelCase.
String get jsonName => $value($fields.jsonName);
FieldOptions? get options => $value($fields.options);
/// If true, this is a proto3 "optional". When a proto3 field is optional, it
/// tracks presence regardless of field type.
///
/// When proto3_optional is true, this field must belong to a oneof to signal
/// to old proto3 clients that presence is tracked for this field. This oneof
/// is known as a "synthetic" oneof, and this field must be its sole member
/// (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs
/// exist in the descriptor only, and do not generate any API. Synthetic oneofs
/// must be ordered after all "real" oneofs.
///
/// For message fields, proto3_optional doesn't create any semantic change,
/// since non-repeated message fields always track presence. However it still
/// indicates the semantic detail of whether the user wrote "optional" or not.
/// This can be useful for round-tripping the .proto file. For consistency we
/// give message fields a synthetic oneof also, even though it is not required
/// to track presence. This is especially important because the parser can't
/// tell if a field is a message or an enum, so it must always create a
/// synthetic oneof.
///
/// Proto2 optional fields do not set this flag, because they already indicate
/// optional with `LABEL_OPTIONAL`.
bool get proto3Optional => $value($fields.proto3Optional);
}
class FieldDescriptorProto$Type extends ProtoEnum {
const FieldDescriptorProto$Type(super.$value, super.name);
static const List<FieldDescriptorProto$Type> values = [
TYPE_DOUBLE,
TYPE_FLOAT,
TYPE_INT64,
TYPE_UINT64,
TYPE_INT32,
TYPE_FIXED64,
TYPE_FIXED32,
TYPE_BOOL,
TYPE_STRING,
TYPE_GROUP,
TYPE_MESSAGE,
TYPE_BYTES,
TYPE_UINT32,
TYPE_ENUM,
TYPE_SFIXED32,
TYPE_SFIXED64,
TYPE_SINT32,
TYPE_SINT64,
];
/// 0 is reserved for errors.
/// Order is weird for historical reasons.
static const TYPE_DOUBLE = FieldDescriptorProto$Type(1, 'TYPE_DOUBLE');
static const TYPE_FLOAT = FieldDescriptorProto$Type(2, 'TYPE_FLOAT');
/// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
/// negative values are likely.
static const TYPE_INT64 = FieldDescriptorProto$Type(3, 'TYPE_INT64');
static const TYPE_UINT64 = FieldDescriptorProto$Type(4, 'TYPE_UINT64');
/// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
/// negative values are likely.
static const TYPE_INT32 = FieldDescriptorProto$Type(5, 'TYPE_INT32');
static const TYPE_FIXED64 = FieldDescriptorProto$Type(6, 'TYPE_FIXED64');
static const TYPE_FIXED32 = FieldDescriptorProto$Type(7, 'TYPE_FIXED32');
static const TYPE_BOOL = FieldDescriptorProto$Type(8, 'TYPE_BOOL');
static const TYPE_STRING = FieldDescriptorProto$Type(9, 'TYPE_STRING');
/// Tag-delimited aggregate.
/// Group type is deprecated and not supported after google.protobuf. However, Proto3
/// implementations should still be able to parse the group wire format and
/// treat group fields as unknown fields. In Editions, the group wire format
/// can be enabled via the `message_encoding` feature.
static const TYPE_GROUP = FieldDescriptorProto$Type(10, 'TYPE_GROUP');
static const TYPE_MESSAGE = FieldDescriptorProto$Type(11, 'TYPE_MESSAGE');
/// New in version 2.
static const TYPE_BYTES = FieldDescriptorProto$Type(12, 'TYPE_BYTES');
static const TYPE_UINT32 = FieldDescriptorProto$Type(13, 'TYPE_UINT32');
static const TYPE_ENUM = FieldDescriptorProto$Type(14, 'TYPE_ENUM');
static const TYPE_SFIXED32 = FieldDescriptorProto$Type(15, 'TYPE_SFIXED32');
static const TYPE_SFIXED64 = FieldDescriptorProto$Type(16, 'TYPE_SFIXED64');
static const TYPE_SINT32 = FieldDescriptorProto$Type(17, 'TYPE_SINT32');
static const TYPE_SINT64 = FieldDescriptorProto$Type(18, 'TYPE_SINT64');
}
class FieldDescriptorProto$Label extends ProtoEnum {
const FieldDescriptorProto$Label(super.$value, super.name);
static const List<FieldDescriptorProto$Label> values = [
LABEL_OPTIONAL,
LABEL_REPEATED,
LABEL_REQUIRED,
];
/// 0 is reserved for errors
static const LABEL_OPTIONAL = FieldDescriptorProto$Label(1, 'LABEL_OPTIONAL');
static const LABEL_REPEATED = FieldDescriptorProto$Label(3, 'LABEL_REPEATED');
/// The required label is only allowed in google.protobuf. In proto3 and Editions
/// it's explicitly prohibited. In Editions, the `field_presence` feature
/// can be used to get this behavior.
static const LABEL_REQUIRED = FieldDescriptorProto$Label(2, 'LABEL_REQUIRED');
}
/// Describes a oneof.
class OneofDescriptorProto extends ProtoMessage {
OneofDescriptorProto({String? name, OneofOptions? options}) {
if (name != null) $values[$fields.name] = name;
if (options != null) $values[$fields.options] = options;
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
options: ProtoField<OneofOptions>(2, 'options'),
);
String get name => $value($fields.name);
OneofOptions? get options => $value($fields.options);
}
/// Describes an enum type.
class EnumDescriptorProto extends ProtoMessage {
EnumDescriptorProto({
String? name,
List<EnumValueDescriptorProto>? value,
EnumOptions? options,
List<EnumDescriptorProto$EnumReservedRange>? reservedRange,
List<String>? reservedName,
}) {
if (name != null) $values[$fields.name] = name;
if (value != null) $values[$fields.value] = value;
if (options != null) $values[$fields.options] = options;
if (reservedRange != null) $values[$fields.reservedRange] = reservedRange;
if (reservedName != null) $values[$fields.reservedName] = reservedName;
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
value: ProtoField<EnumValueDescriptorProto>(2, 'value'),
options: ProtoField<EnumOptions>(3, 'options'),
reservedRange: ProtoField<EnumDescriptorProto$EnumReservedRange>(
4,
'reserved_range',
),
reservedName: ProtoField<String>(5, 'reserved_name', ''),
);
String get name => $value($fields.name);
List<EnumValueDescriptorProto> get value => $value($fields.value);
EnumOptions? get options => $value($fields.options);
/// Range of reserved numeric values. Reserved numeric values may not be used
/// by enum values in the same enum declaration. Reserved ranges may not
/// overlap.
List<EnumDescriptorProto$EnumReservedRange> get reservedRange =>
$value($fields.reservedRange);
/// Reserved enum value names, which may not be reused. A given name may only
/// be reserved once.
List<String> get reservedName => $value($fields.reservedName);
}
/// Range of reserved numeric values. Reserved values may not be used by
/// entries in the same enum. Reserved ranges may not overlap.
///
/// Note that this is distinct from DescriptorProto.ReservedRange in that it
/// is inclusive such that it can appropriately represent the entire int32
/// domain.
class EnumDescriptorProto$EnumReservedRange extends ProtoMessage {
EnumDescriptorProto$EnumReservedRange({int? start, int? end}) {
if (start != null) $values[$fields.start] = start;
if (end != null) $values[$fields.end] = end;
}
static final $fields = (
start: ProtoField<int>(1, 'start', 0),
end: ProtoField<int>(2, 'end', 0),
);
int get start => $value($fields.start);
int get end => $value($fields.end);
}
/// Describes a value within an enum.
class EnumValueDescriptorProto extends ProtoMessage {
EnumValueDescriptorProto({
String? name,
int? number,
EnumValueOptions? options,
}) {
if (name != null) $values[$fields.name] = name;
if (number != null) $values[$fields.number] = number;
if (options != null) $values[$fields.options] = options;
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
number: ProtoField<int>(2, 'number', 0),
options: ProtoField<EnumValueOptions>(3, 'options'),
);
String get name => $value($fields.name);
int get number => $value($fields.number);
EnumValueOptions? get options => $value($fields.options);
}
/// Describes a service.
class ServiceDescriptorProto extends ProtoMessage {
ServiceDescriptorProto({
String? name,
List<MethodDescriptorProto>? method,
ServiceOptions? options,
}) {
if (name != null) $values[$fields.name] = name;
if (method != null) $values[$fields.method] = method;
if (options != null) $values[$fields.options] = options;
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
method: ProtoField<MethodDescriptorProto>(2, 'method'),
options: ProtoField<ServiceOptions>(3, 'options'),
);
String get name => $value($fields.name);
List<MethodDescriptorProto> get method => $value($fields.method);
ServiceOptions? get options => $value($fields.options);
}
/// Describes a method of a service.
class MethodDescriptorProto extends ProtoMessage {
MethodDescriptorProto({
String? name,
String? inputType,
String? outputType,
MethodOptions? options,
bool? clientStreaming,
bool? serverStreaming,
}) {
if (name != null) $values[$fields.name] = name;
if (inputType != null) $values[$fields.inputType] = inputType;
if (outputType != null) $values[$fields.outputType] = outputType;
if (options != null) $values[$fields.options] = options;
if (clientStreaming != null) {
$values[$fields.clientStreaming] = clientStreaming;
}
if (serverStreaming != null) {
$values[$fields.serverStreaming] = serverStreaming;
}
}
static final $fields = (
name: ProtoField<String>(1, 'name', ''),
inputType: ProtoField<String>(2, 'input_type', ''),
outputType: ProtoField<String>(3, 'output_type', ''),
options: ProtoField<MethodOptions>(4, 'options'),
clientStreaming: ProtoField<bool>(5, 'client_streaming', false),
serverStreaming: ProtoField<bool>(6, 'server_streaming', false),
);
String get name => $value($fields.name);
/// Input and output type names. These are resolved in the same way as
/// FieldDescriptorProto.type_name, but must refer to a message type.
String get inputType => $value($fields.inputType);
String get outputType => $value($fields.outputType);
MethodOptions? get options => $value($fields.options);
/// Identifies if client streams multiple client messages
bool get clientStreaming => $value($fields.clientStreaming);
/// Identifies if server streams multiple server messages
bool get serverStreaming => $value($fields.serverStreaming);
}
class FileOptions extends ProtoMessage {
FileOptions({
String? javaPackage,
String? javaOuterClassname,
bool? javaMultipleFiles,
bool? javaGenerateEqualsAndHash,
bool? javaStringCheckUtf8,
FileOptions$OptimizeMode? optimizeFor,
String? goPackage,
bool? ccGenericServices,
bool? javaGenericServices,
bool? pyGenericServices,
bool? $deprecated,
bool? ccEnableArenas,
String? objcClassPrefix,
String? csharpNamespace,
String? swiftPrefix,
String? phpClassPrefix,
String? phpNamespace,
String? phpMetadataNamespace,
String? rubyPackage,
FeatureSet? features,
List<UninterpretedOption>? uninterpretedOption,
}) {
if (javaPackage != null) $values[$fields.javaPackage] = javaPackage;
if (javaOuterClassname != null) {
$values[$fields.javaOuterClassname] = javaOuterClassname;
}
if (javaMultipleFiles != null) {
$values[$fields.javaMultipleFiles] = javaMultipleFiles;
}
if (javaGenerateEqualsAndHash != null) {
$values[$fields.javaGenerateEqualsAndHash] = javaGenerateEqualsAndHash;
}
if (javaStringCheckUtf8 != null) {
$values[$fields.javaStringCheckUtf8] = javaStringCheckUtf8;
}
if (optimizeFor != null) $values[$fields.optimizeFor] = optimizeFor;
if (goPackage != null) $values[$fields.goPackage] = goPackage;
if (ccGenericServices != null) {
$values[$fields.ccGenericServices] = ccGenericServices;
}
if (javaGenericServices != null) {
$values[$fields.javaGenericServices] = javaGenericServices;
}
if (pyGenericServices != null) {
$values[$fields.pyGenericServices] = pyGenericServices;
}
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (ccEnableArenas != null) {
$values[$fields.ccEnableArenas] = ccEnableArenas;
}
if (objcClassPrefix != null) {
$values[$fields.objcClassPrefix] = objcClassPrefix;
}
if (csharpNamespace != null) {
$values[$fields.csharpNamespace] = csharpNamespace;
}
if (swiftPrefix != null) $values[$fields.swiftPrefix] = swiftPrefix;
if (phpClassPrefix != null) {
$values[$fields.phpClassPrefix] = phpClassPrefix;
}
if (phpNamespace != null) $values[$fields.phpNamespace] = phpNamespace;
if (phpMetadataNamespace != null) {
$values[$fields.phpMetadataNamespace] = phpMetadataNamespace;
}
if (rubyPackage != null) $values[$fields.rubyPackage] = rubyPackage;
if (features != null) $values[$fields.features] = features;
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
javaPackage: ProtoField<String>(1, 'java_package', ''),
javaOuterClassname: ProtoField<String>(8, 'java_outer_classname', ''),
javaMultipleFiles: ProtoField<bool>(10, 'java_multiple_files', false),
javaGenerateEqualsAndHash: ProtoField<bool>(
20,
'java_generate_equals_and_hash',
false,
),
javaStringCheckUtf8: ProtoField<bool>(27, 'java_string_check_utf8', false),
optimizeFor: ProtoField<FileOptions$OptimizeMode>(
9,
'optimize_for',
FileOptions$OptimizeMode.SPEED,
),
goPackage: ProtoField<String>(11, 'go_package', ''),
ccGenericServices: ProtoField<bool>(16, 'cc_generic_services', false),
javaGenericServices: ProtoField<bool>(17, 'java_generic_services', false),
pyGenericServices: ProtoField<bool>(18, 'py_generic_services', false),
$deprecated: ProtoField<bool>(23, 'deprecated', false),
ccEnableArenas: ProtoField<bool>(31, 'cc_enable_arenas', false),
objcClassPrefix: ProtoField<String>(36, 'objc_class_prefix', ''),
csharpNamespace: ProtoField<String>(37, 'csharp_namespace', ''),
swiftPrefix: ProtoField<String>(39, 'swift_prefix', ''),
phpClassPrefix: ProtoField<String>(40, 'php_class_prefix', ''),
phpNamespace: ProtoField<String>(41, 'php_namespace', ''),
phpMetadataNamespace: ProtoField<String>(44, 'php_metadata_namespace', ''),
rubyPackage: ProtoField<String>(45, 'ruby_package', ''),
features: ProtoField<FeatureSet>(50, 'features'),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Sets the Java package where classes generated from this .proto will be
/// placed. By default, the proto package is used, but this is often
/// inappropriate because proto packages do not normally start with backwards
/// domain names.
String get javaPackage => $value($fields.javaPackage);
/// Controls the name of the wrapper Java class generated for the .proto file.
/// That class will always contain the .proto file's getDescriptor() method as
/// well as any top-level extensions defined in the .proto file.
/// If java_multiple_files is disabled, then all the other classes from the
/// .proto file will be nested inside the single wrapper outer class.
String get javaOuterClassname => $value($fields.javaOuterClassname);
/// If enabled, then the Java code generator will generate a separate .java
/// file for each top-level message, enum, and service defined in the .proto
/// file. Thus, these types will *not* be nested inside the wrapper class
/// named by java_outer_classname. However, the wrapper class will still be
/// generated to contain the file's getDescriptor() method as well as any
/// top-level extensions defined in the file.
bool get javaMultipleFiles => $value($fields.javaMultipleFiles);
/// This option does nothing.
@Deprecated('This item may be removed in the next major version.')
bool get javaGenerateEqualsAndHash =>
$value($fields.javaGenerateEqualsAndHash);
/// A proto2 file can set this to true to opt in to UTF-8 checking for Java,
/// which will throw an exception if invalid UTF-8 is parsed from the wire or
/// assigned to a string field.
///
/// TODO: clarify exactly what kinds of field types this option
/// applies to, and update these docs accordingly.
///
/// Proto3 files already perform these checks. Setting the option explicitly to
/// false has no effect: it cannot be used to opt proto3 files out of UTF-8
/// checks.
bool get javaStringCheckUtf8 => $value($fields.javaStringCheckUtf8);
FileOptions$OptimizeMode get optimizeFor => $value($fields.optimizeFor);
/// Sets the Go package where structs generated from this .proto will be
/// placed. If omitted, the Go package will be derived from the following:
/// - The basename of the package import path, if provided.
/// - Otherwise, the package statement in the .proto file, if present.
/// - Otherwise, the basename of the .proto file, without extension.
String get goPackage => $value($fields.goPackage);
/// Should generic services be generated in each language? "Generic" services
/// are not specific to any particular RPC system. They are generated by the
/// main code generators in each language (without additional plugins).
/// Generic services were the only kind of service generation supported by
/// early versions of google.protobuf.
///
/// Generic services are now considered deprecated in favor of using plugins
/// that generate code specific to your particular RPC system. Therefore,
/// these default to false. Old code which depends on generic services should
/// explicitly set them to true.
bool get ccGenericServices => $value($fields.ccGenericServices);
bool get javaGenericServices => $value($fields.javaGenericServices);
bool get pyGenericServices => $value($fields.pyGenericServices);
/// Is this file deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for everything in the file, or it will be completely ignored; in the very
/// least, this is a formalization for deprecating files.
bool get $deprecated => $value($fields.$deprecated);
/// Enables the use of arenas for the proto messages in this file. This applies
/// only to generated classes for C++.
bool get ccEnableArenas => $value($fields.ccEnableArenas);
/// Sets the objective c class prefix which is prepended to all objective c
/// generated classes from this .proto. There is no default.
String get objcClassPrefix => $value($fields.objcClassPrefix);
/// Namespace for generated classes; defaults to the package.
String get csharpNamespace => $value($fields.csharpNamespace);
/// By default Swift generators will take the proto package and CamelCase it
/// replacing '.' with underscore and use that to prefix the types/symbols
/// defined. When this options is provided, they will use this value instead
/// to prefix the types/symbols defined.
String get swiftPrefix => $value($fields.swiftPrefix);
/// Sets the php class prefix which is prepended to all php generated classes
/// from this .proto. Default is empty.
String get phpClassPrefix => $value($fields.phpClassPrefix);
/// Use this option to change the namespace of php generated classes. Default
/// is empty. When this option is empty, the package name will be used for
/// determining the namespace.
String get phpNamespace => $value($fields.phpNamespace);
/// Use this option to change the namespace of php generated metadata classes.
/// Default is empty. When this option is empty, the proto file name will be
/// used for determining the namespace.
String get phpMetadataNamespace => $value($fields.phpMetadataNamespace);
/// Use this option to change the package of ruby generated classes. Default
/// is empty. When this option is not set, the package name will be used for
/// determining the ruby package.
String get rubyPackage => $value($fields.rubyPackage);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// The parser stores options it doesn't recognize here.
/// See the documentation for the "Options" section above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
/// Generated classes can be optimized for speed or code size.
class FileOptions$OptimizeMode extends ProtoEnum {
const FileOptions$OptimizeMode(super.$value, super.name);
static const List<FileOptions$OptimizeMode> values = [
SPEED,
CODE_SIZE,
LITE_RUNTIME,
];
static const SPEED = FileOptions$OptimizeMode(1, 'SPEED');
/// etc.
static const CODE_SIZE = FileOptions$OptimizeMode(2, 'CODE_SIZE');
static const LITE_RUNTIME = FileOptions$OptimizeMode(3, 'LITE_RUNTIME');
}
class MessageOptions extends ProtoMessage {
MessageOptions({
bool? messageSetWireFormat,
bool? noStandardDescriptorAccessor,
bool? $deprecated,
bool? mapEntry,
bool? deprecatedLegacyJsonFieldConflicts,
FeatureSet? features,
List<UninterpretedOption>? uninterpretedOption,
}) {
if (messageSetWireFormat != null) {
$values[$fields.messageSetWireFormat] = messageSetWireFormat;
}
if (noStandardDescriptorAccessor != null) {
$values[$fields.noStandardDescriptorAccessor] =
noStandardDescriptorAccessor;
}
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (mapEntry != null) $values[$fields.mapEntry] = mapEntry;
if (deprecatedLegacyJsonFieldConflicts != null) {
$values[$fields.deprecatedLegacyJsonFieldConflicts] =
deprecatedLegacyJsonFieldConflicts;
}
if (features != null) $values[$fields.features] = features;
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
messageSetWireFormat: ProtoField<bool>(1, 'message_set_wire_format', false),
noStandardDescriptorAccessor: ProtoField<bool>(
2,
'no_standard_descriptor_accessor',
false,
),
$deprecated: ProtoField<bool>(3, 'deprecated', false),
mapEntry: ProtoField<bool>(7, 'map_entry', false),
deprecatedLegacyJsonFieldConflicts: ProtoField<bool>(
11,
'deprecated_legacy_json_field_conflicts',
false,
),
features: ProtoField<FeatureSet>(12, 'features'),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Set true to use the old proto1 MessageSet wire format for extensions.
/// This is provided for backwards-compatibility with the MessageSet wire
/// format. You should not use this for any other reason: It's less
/// efficient, has fewer features, and is more complicated.
///
/// The message must be defined exactly as follows:
/// message Foo {
/// option message_set_wire_format = true;
/// extensions 4 to max;
/// }
/// Note that the message cannot have any defined fields; MessageSets only
/// have extensions.
///
/// All extensions of your type must be singular messages; e.g. they cannot
/// be int32s, enums, or repeated messages.
///
/// Because this is an option, the above two restrictions are not enforced by
/// the protocol compiler.
bool get messageSetWireFormat => $value($fields.messageSetWireFormat);
/// Disables the generation of the standard "descriptor()" accessor, which can
/// conflict with a field of the same name. This is meant to make migration
/// from proto1 easier; new code should avoid fields named "descriptor".
bool get noStandardDescriptorAccessor =>
$value($fields.noStandardDescriptorAccessor);
/// Is this message deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for the message, or it will be completely ignored; in the very least,
/// this is a formalization for deprecating messages.
bool get $deprecated => $value($fields.$deprecated);
/// Whether the message is an automatically generated map entry type for the
/// maps field.
///
/// For maps fields:
/// map<KeyType, ValueType> map_field = 1;
/// The parsed descriptor looks like:
/// message MapFieldEntry {
/// option map_entry = true;
/// optional KeyType key = 1;
/// optional ValueType value = 2;
/// }
/// repeated MapFieldEntry map_field = 1;
///
/// Implementations may choose not to generate the map_entry=true message, but
/// use a native map in the target language to hold the keys and values.
/// The reflection APIs in such implementations still need to work as
/// if the field is a repeated message field.
///
/// NOTE: Do not set the option in .proto files. Always use the maps syntax
/// instead. The option should only be implicitly set by the proto compiler
/// parser.
bool get mapEntry => $value($fields.mapEntry);
/// Enable the legacy handling of JSON field name conflicts. This lowercases
/// and strips underscored from the fields before comparison in proto3 only.
/// The new behavior takes `json_name` into account and applies to proto2 as
/// well.
///
/// This should only be used as a temporary measure against broken builds due
/// to the change in behavior for JSON field name conflicts.
///
/// TODO This is legacy behavior we plan to remove once downstream
/// teams have had time to migrate.
@Deprecated('This item may be removed in the next major version.')
bool get deprecatedLegacyJsonFieldConflicts =>
$value($fields.deprecatedLegacyJsonFieldConflicts);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
class FieldOptions extends ProtoMessage {
FieldOptions({
FieldOptions$CType? ctype,
bool? packed,
FieldOptions$JSType? jstype,
bool? lazy,
bool? unverifiedLazy,
bool? $deprecated,
bool? weak,
bool? debugRedact,
FieldOptions$OptionRetention? retention,
List<FieldOptions$OptionTargetType>? targets,
List<FieldOptions$EditionDefault>? editionDefaults,
FeatureSet? features,
FieldOptions$FeatureSupport? featureSupport,
List<UninterpretedOption>? uninterpretedOption,
}) {
if (ctype != null) $values[$fields.ctype] = ctype;
if (packed != null) $values[$fields.packed] = packed;
if (jstype != null) $values[$fields.jstype] = jstype;
if (lazy != null) $values[$fields.lazy] = lazy;
if (unverifiedLazy != null) {
$values[$fields.unverifiedLazy] = unverifiedLazy;
}
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (weak != null) $values[$fields.weak] = weak;
if (debugRedact != null) $values[$fields.debugRedact] = debugRedact;
if (retention != null) $values[$fields.retention] = retention;
if (targets != null) $values[$fields.targets] = targets;
if (editionDefaults != null) {
$values[$fields.editionDefaults] = editionDefaults;
}
if (features != null) $values[$fields.features] = features;
if (featureSupport != null) {
$values[$fields.featureSupport] = featureSupport;
}
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
ctype: ProtoField<FieldOptions$CType>(
1,
'ctype',
FieldOptions$CType.STRING,
),
packed: ProtoField<bool>(2, 'packed', false),
jstype: ProtoField<FieldOptions$JSType>(
6,
'jstype',
FieldOptions$JSType.JS_NORMAL,
),
lazy: ProtoField<bool>(5, 'lazy', false),
unverifiedLazy: ProtoField<bool>(15, 'unverified_lazy', false),
$deprecated: ProtoField<bool>(3, 'deprecated', false),
weak: ProtoField<bool>(10, 'weak', false),
debugRedact: ProtoField<bool>(16, 'debug_redact', false),
retention: ProtoField<FieldOptions$OptionRetention>(
17,
'retention',
FieldOptions$OptionRetention.RETENTION_UNKNOWN,
),
targets: ProtoField<FieldOptions$OptionTargetType>(
19,
'targets',
FieldOptions$OptionTargetType.TARGET_TYPE_UNKNOWN,
),
editionDefaults: ProtoField<FieldOptions$EditionDefault>(
20,
'edition_defaults',
),
features: ProtoField<FeatureSet>(21, 'features'),
featureSupport: ProtoField<FieldOptions$FeatureSupport>(
22,
'feature_support',
),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// NOTE: ctype is deprecated. Use `features.(pb.cpp).string_type` instead.
/// The ctype option instructs the C++ code generator to use a different
/// representation of the field than it normally would. See the specific
/// options below. This option is only implemented to support use of
/// [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of
/// type "bytes" in the open source release.
/// TODO: make ctype actually deprecated.
FieldOptions$CType get ctype => $value($fields.ctype);
/// The packed option can be enabled for repeated primitive fields to enable
/// a more efficient representation on the wire. Rather than repeatedly
/// writing the tag and type for each element, the entire array is encoded as
/// a single length-delimited blob. In proto3, only explicit setting it to
/// false will avoid using packed encoding. This option is prohibited in
/// Editions, but the `repeated_field_encoding` feature can be used to control
/// the behavior.
bool get packed => $value($fields.packed);
/// The jstype option determines the JavaScript type used for values of the
/// field. The option is permitted only for 64 bit integral and fixed types
/// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
/// is represented as JavaScript string, which avoids loss of precision that
/// can happen when a large value is converted to a floating point JavaScript.
/// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
/// use the JavaScript "number" type. The behavior of the default option
/// JS_NORMAL is implementation dependent.
///
/// This option is an enum to permit additional types to be added, e.g.
/// goog.math.Integer.
FieldOptions$JSType get jstype => $value($fields.jstype);
/// Should this field be parsed lazily? Lazy applies only to message-type
/// fields. It means that when the outer message is initially parsed, the
/// inner message's contents will not be parsed but instead stored in encoded
/// form. The inner message will actually be parsed when it is first accessed.
///
/// This is only a hint. Implementations are free to choose whether to use
/// eager or lazy parsing regardless of the value of this option. However,
/// setting this option true suggests that the protocol author believes that
/// using lazy parsing on this field is worth the additional bookkeeping
/// overhead typically needed to implement it.
///
/// This option does not affect the public interface of any generated code;
/// all method signatures remain the same. Furthermore, thread-safety of the
/// interface is not affected by this option; const methods remain safe to
/// call from multiple threads concurrently, while non-const methods continue
/// to require exclusive access.
///
/// Note that lazy message fields are still eagerly verified to check
/// ill-formed wireformat or missing required fields. Calling IsInitialized()
/// on the outer message would fail if the inner message has missing required
/// fields. Failed verification would result in parsing failure (except when
/// uninitialized messages are acceptable).
bool get lazy => $value($fields.lazy);
/// unverified_lazy does no correctness checks on the byte stream. This should
/// only be used where lazy with verification is prohibitive for performance
/// reasons.
bool get unverifiedLazy => $value($fields.unverifiedLazy);
/// Is this field deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for accessors, or it will be completely ignored; in the very least, this
/// is a formalization for deprecating fields.
bool get $deprecated => $value($fields.$deprecated);
/// For Google-internal migration only. Do not use.
bool get weak => $value($fields.weak);
/// Indicate that the field value should not be printed out when using debug
/// formats, e.g. when the field contains sensitive credentials.
bool get debugRedact => $value($fields.debugRedact);
FieldOptions$OptionRetention get retention => $value($fields.retention);
List<FieldOptions$OptionTargetType> get targets => $value($fields.targets);
List<FieldOptions$EditionDefault> get editionDefaults =>
$value($fields.editionDefaults);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
FieldOptions$FeatureSupport? get featureSupport =>
$value($fields.featureSupport);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
class FieldOptions$EditionDefault extends ProtoMessage {
FieldOptions$EditionDefault({Edition? edition, String? value}) {
if (edition != null) $values[$fields.edition] = edition;
if (value != null) $values[$fields.value] = value;
}
static final $fields = (
edition: ProtoField<Edition>(3, 'edition', Edition.EDITION_UNKNOWN),
value: ProtoField<String>(2, 'value', ''),
);
Edition get edition => $value($fields.edition);
String get value => $value($fields.value);
}
/// Information about the support window of a feature.
class FieldOptions$FeatureSupport extends ProtoMessage {
FieldOptions$FeatureSupport({
Edition? editionIntroduced,
Edition? editionDeprecated,
String? deprecationWarning,
Edition? editionRemoved,
}) {
if (editionIntroduced != null) {
$values[$fields.editionIntroduced] = editionIntroduced;
}
if (editionDeprecated != null) {
$values[$fields.editionDeprecated] = editionDeprecated;
}
if (deprecationWarning != null) {
$values[$fields.deprecationWarning] = deprecationWarning;
}
if (editionRemoved != null) {
$values[$fields.editionRemoved] = editionRemoved;
}
}
static final $fields = (
editionIntroduced: ProtoField<Edition>(
1,
'edition_introduced',
Edition.EDITION_UNKNOWN,
),
editionDeprecated: ProtoField<Edition>(
2,
'edition_deprecated',
Edition.EDITION_UNKNOWN,
),
deprecationWarning: ProtoField<String>(3, 'deprecation_warning', ''),
editionRemoved: ProtoField<Edition>(
4,
'edition_removed',
Edition.EDITION_UNKNOWN,
),
);
/// The edition that this feature was first available in. In editions
/// earlier than this one, the default assigned to EDITION_LEGACY will be
/// used, and proto files will not be able to override it.
Edition get editionIntroduced => $value($fields.editionIntroduced);
/// The edition this feature becomes deprecated in. Using this after this
/// edition may trigger warnings.
Edition get editionDeprecated => $value($fields.editionDeprecated);
/// The deprecation warning text if this feature is used after the edition it
/// was marked deprecated in.
String get deprecationWarning => $value($fields.deprecationWarning);
/// The edition this feature is no longer available in. In editions after
/// this one, the last default assigned will be used, and proto files will
/// not be able to override it.
Edition get editionRemoved => $value($fields.editionRemoved);
}
class FieldOptions$CType extends ProtoEnum {
const FieldOptions$CType(super.$value, super.name);
static const List<FieldOptions$CType> values = [STRING, CORD, STRING_PIECE];
/// Default mode.
static const STRING = FieldOptions$CType(0, 'STRING');
/// The option [ctype=CORD] may be applied to a non-repeated field of type
/// "bytes". It indicates that in C++, the data should be stored in a Cord
/// instead of a string. For very large strings, this may reduce memory
/// fragmentation. It may also allow better performance when parsing from a
/// Cord, or when parsing with aliasing enabled, as the parsed Cord may then
/// alias the original buffer.
static const CORD = FieldOptions$CType(1, 'CORD');
static const STRING_PIECE = FieldOptions$CType(2, 'STRING_PIECE');
}
class FieldOptions$JSType extends ProtoEnum {
const FieldOptions$JSType(super.$value, super.name);
static const List<FieldOptions$JSType> values = [
JS_NORMAL,
JS_STRING,
JS_NUMBER,
];
/// Use the default type.
static const JS_NORMAL = FieldOptions$JSType(0, 'JS_NORMAL');
/// Use JavaScript strings.
static const JS_STRING = FieldOptions$JSType(1, 'JS_STRING');
/// Use JavaScript numbers.
static const JS_NUMBER = FieldOptions$JSType(2, 'JS_NUMBER');
}
/// If set to RETENTION_SOURCE, the option will be omitted from the binary.
class FieldOptions$OptionRetention extends ProtoEnum {
const FieldOptions$OptionRetention(super.$value, super.name);
static const List<FieldOptions$OptionRetention> values = [
RETENTION_UNKNOWN,
RETENTION_RUNTIME,
RETENTION_SOURCE,
];
static const RETENTION_UNKNOWN = FieldOptions$OptionRetention(
0,
'RETENTION_UNKNOWN',
);
static const RETENTION_RUNTIME = FieldOptions$OptionRetention(
1,
'RETENTION_RUNTIME',
);
static const RETENTION_SOURCE = FieldOptions$OptionRetention(
2,
'RETENTION_SOURCE',
);
}
/// This indicates the types of entities that the field may apply to when used
/// as an option. If it is unset, then the field may be freely used as an
/// option on any kind of entity.
class FieldOptions$OptionTargetType extends ProtoEnum {
const FieldOptions$OptionTargetType(super.$value, super.name);
static const List<FieldOptions$OptionTargetType> values = [
TARGET_TYPE_UNKNOWN,
TARGET_TYPE_FILE,
TARGET_TYPE_EXTENSION_RANGE,
TARGET_TYPE_MESSAGE,
TARGET_TYPE_FIELD,
TARGET_TYPE_ONEOF,
TARGET_TYPE_ENUM,
TARGET_TYPE_ENUM_ENTRY,
TARGET_TYPE_SERVICE,
TARGET_TYPE_METHOD,
];
static const TARGET_TYPE_UNKNOWN = FieldOptions$OptionTargetType(
0,
'TARGET_TYPE_UNKNOWN',
);
static const TARGET_TYPE_FILE = FieldOptions$OptionTargetType(
1,
'TARGET_TYPE_FILE',
);
static const TARGET_TYPE_EXTENSION_RANGE = FieldOptions$OptionTargetType(
2,
'TARGET_TYPE_EXTENSION_RANGE',
);
static const TARGET_TYPE_MESSAGE = FieldOptions$OptionTargetType(
3,
'TARGET_TYPE_MESSAGE',
);
static const TARGET_TYPE_FIELD = FieldOptions$OptionTargetType(
4,
'TARGET_TYPE_FIELD',
);
static const TARGET_TYPE_ONEOF = FieldOptions$OptionTargetType(
5,
'TARGET_TYPE_ONEOF',
);
static const TARGET_TYPE_ENUM = FieldOptions$OptionTargetType(
6,
'TARGET_TYPE_ENUM',
);
static const TARGET_TYPE_ENUM_ENTRY = FieldOptions$OptionTargetType(
7,
'TARGET_TYPE_ENUM_ENTRY',
);
static const TARGET_TYPE_SERVICE = FieldOptions$OptionTargetType(
8,
'TARGET_TYPE_SERVICE',
);
static const TARGET_TYPE_METHOD = FieldOptions$OptionTargetType(
9,
'TARGET_TYPE_METHOD',
);
}
class OneofOptions extends ProtoMessage {
OneofOptions({
FeatureSet? features,
List<UninterpretedOption>? uninterpretedOption,
}) {
if (features != null) $values[$fields.features] = features;
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
features: ProtoField<FeatureSet>(1, 'features'),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
class EnumOptions extends ProtoMessage {
EnumOptions({
bool? allowAlias,
bool? $deprecated,
bool? deprecatedLegacyJsonFieldConflicts,
FeatureSet? features,
List<UninterpretedOption>? uninterpretedOption,
}) {
if (allowAlias != null) $values[$fields.allowAlias] = allowAlias;
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (deprecatedLegacyJsonFieldConflicts != null) {
$values[$fields.deprecatedLegacyJsonFieldConflicts] =
deprecatedLegacyJsonFieldConflicts;
}
if (features != null) $values[$fields.features] = features;
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
allowAlias: ProtoField<bool>(2, 'allow_alias', false),
$deprecated: ProtoField<bool>(3, 'deprecated', false),
deprecatedLegacyJsonFieldConflicts: ProtoField<bool>(
6,
'deprecated_legacy_json_field_conflicts',
false,
),
features: ProtoField<FeatureSet>(7, 'features'),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Set this option to true to allow mapping different tag names to the same
/// value.
bool get allowAlias => $value($fields.allowAlias);
/// Is this enum deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for the enum, or it will be completely ignored; in the very least, this
/// is a formalization for deprecating enums.
bool get $deprecated => $value($fields.$deprecated);
/// Enable the legacy handling of JSON field name conflicts. This lowercases
/// and strips underscored from the fields before comparison in proto3 only.
/// The new behavior takes `json_name` into account and applies to proto2 as
/// well.
/// TODO Remove this legacy behavior once downstream teams have
/// had time to migrate.
@Deprecated('This item may be removed in the next major version.')
bool get deprecatedLegacyJsonFieldConflicts =>
$value($fields.deprecatedLegacyJsonFieldConflicts);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
class EnumValueOptions extends ProtoMessage {
EnumValueOptions({
bool? $deprecated,
FeatureSet? features,
bool? debugRedact,
FieldOptions$FeatureSupport? featureSupport,
List<UninterpretedOption>? uninterpretedOption,
}) {
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (features != null) $values[$fields.features] = features;
if (debugRedact != null) $values[$fields.debugRedact] = debugRedact;
if (featureSupport != null) {
$values[$fields.featureSupport] = featureSupport;
}
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
$deprecated: ProtoField<bool>(1, 'deprecated', false),
features: ProtoField<FeatureSet>(2, 'features'),
debugRedact: ProtoField<bool>(3, 'debug_redact', false),
featureSupport: ProtoField<FieldOptions$FeatureSupport>(
4,
'feature_support',
),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Is this enum value deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for the enum value, or it will be completely ignored; in the very least,
/// this is a formalization for deprecating enum values.
bool get $deprecated => $value($fields.$deprecated);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// Indicate that fields annotated with this enum value should not be printed
/// out when using debug formats, e.g. when the field contains sensitive
/// credentials.
bool get debugRedact => $value($fields.debugRedact);
/// Information about the support window of a feature value.
FieldOptions$FeatureSupport? get featureSupport =>
$value($fields.featureSupport);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
class ServiceOptions extends ProtoMessage {
ServiceOptions({
FeatureSet? features,
bool? $deprecated,
List<UninterpretedOption>? uninterpretedOption,
}) {
if (features != null) $values[$fields.features] = features;
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
features: ProtoField<FeatureSet>(34, 'features'),
$deprecated: ProtoField<bool>(33, 'deprecated', false),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// Is this service deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for the service, or it will be completely ignored; in the very least,
/// this is a formalization for deprecating services.
bool get $deprecated => $value($fields.$deprecated);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
class MethodOptions extends ProtoMessage {
MethodOptions({
bool? $deprecated,
MethodOptions$IdempotencyLevel? idempotencyLevel,
FeatureSet? features,
List<UninterpretedOption>? uninterpretedOption,
}) {
if ($deprecated != null) $values[$fields.$deprecated] = $deprecated;
if (idempotencyLevel != null) {
$values[$fields.idempotencyLevel] = idempotencyLevel;
}
if (features != null) $values[$fields.features] = features;
if (uninterpretedOption != null) {
$values[$fields.uninterpretedOption] = uninterpretedOption;
}
}
static final $fields = (
$deprecated: ProtoField<bool>(33, 'deprecated', false),
idempotencyLevel: ProtoField<MethodOptions$IdempotencyLevel>(
34,
'idempotency_level',
MethodOptions$IdempotencyLevel.IDEMPOTENCY_UNKNOWN,
),
features: ProtoField<FeatureSet>(35, 'features'),
uninterpretedOption: ProtoField<UninterpretedOption>(
999,
'uninterpreted_option',
),
);
/// Is this method deprecated?
/// Depending on the target platform, this can emit Deprecated annotations
/// for the method, or it will be completely ignored; in the very least,
/// this is a formalization for deprecating methods.
bool get $deprecated => $value($fields.$deprecated);
MethodOptions$IdempotencyLevel get idempotencyLevel =>
$value($fields.idempotencyLevel);
/// Any features defined in the specific edition.
/// WARNING: This field should only be used by protobuf plugins or special
/// cases like the proto compiler. Other uses are discouraged and
/// developers should rely on the protoreflect APIs for their client language.
FeatureSet? get features => $value($fields.features);
/// The parser stores options it doesn't recognize here. See above.
List<UninterpretedOption> get uninterpretedOption =>
$value($fields.uninterpretedOption);
}
/// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
/// or neither? HTTP based RPC implementation may choose GET verb for safe
/// methods, and PUT verb for idempotent methods instead of the default POST.
class MethodOptions$IdempotencyLevel extends ProtoEnum {
const MethodOptions$IdempotencyLevel(super.$value, super.name);
static const List<MethodOptions$IdempotencyLevel> values = [
IDEMPOTENCY_UNKNOWN,
NO_SIDE_EFFECTS,
IDEMPOTENT,
];
static const IDEMPOTENCY_UNKNOWN = MethodOptions$IdempotencyLevel(
0,
'IDEMPOTENCY_UNKNOWN',
);
static const NO_SIDE_EFFECTS = MethodOptions$IdempotencyLevel(
1,
'NO_SIDE_EFFECTS',
);
static const IDEMPOTENT = MethodOptions$IdempotencyLevel(2, 'IDEMPOTENT');
}
/// A message representing a option the parser does not recognize. This only
/// appears in options protos created by the compiler::Parser class.
/// DescriptorPool resolves these when building Descriptor objects. Therefore,
/// options protos in descriptor objects (e.g. returned by Descriptor::options(),
/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
/// in them.
class UninterpretedOption extends ProtoMessage {
UninterpretedOption({
List<UninterpretedOption$NamePart>? name,
String? identifierValue,
Int64? positiveIntValue,
Int64? negativeIntValue,
double? doubleValue,
Uint8List? stringValue,
String? aggregateValue,
}) {
if (name != null) $values[$fields.name] = name;
if (identifierValue != null) {
$values[$fields.identifierValue] = identifierValue;
}
if (positiveIntValue != null) {
$values[$fields.positiveIntValue] = positiveIntValue;
}
if (negativeIntValue != null) {
$values[$fields.negativeIntValue] = negativeIntValue;
}
if (doubleValue != null) $values[$fields.doubleValue] = doubleValue;
if (stringValue != null) $values[$fields.stringValue] = stringValue;
if (aggregateValue != null) {
$values[$fields.aggregateValue] = aggregateValue;
}
}
static final $fields = (
name: ProtoField<UninterpretedOption$NamePart>(2, 'name'),
identifierValue: ProtoField<String>(3, 'identifier_value', ''),
positiveIntValue: ProtoField<Int64>(4, 'positive_int_value', Int64.ZERO),
negativeIntValue: ProtoField<Int64>(5, 'negative_int_value', Int64.ZERO),
doubleValue: ProtoField<double>(6, 'double_value', 0.0),
stringValue: ProtoField<Uint8List>(7, 'string_value', Uint8List(0)),
aggregateValue: ProtoField<String>(8, 'aggregate_value', ''),
);
List<UninterpretedOption$NamePart> get name => $value($fields.name);
/// The value of the uninterpreted option, in whatever type the tokenizer
/// identified it as during parsing. Exactly one of these should be set.
String get identifierValue => $value($fields.identifierValue);
Int64 get positiveIntValue => $value($fields.positiveIntValue);
Int64 get negativeIntValue => $value($fields.negativeIntValue);
double get doubleValue => $value($fields.doubleValue);
Uint8List get stringValue => $value($fields.stringValue);
String get aggregateValue => $value($fields.aggregateValue);
}
/// The name of the uninterpreted option. Each string represents a segment in
/// a dot-separated name. is_extension is true iff a segment represents an
/// extension (denoted with parentheses in options specs in .proto files).
/// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
/// "foo.(bar.baz).moo".
class UninterpretedOption$NamePart extends ProtoMessage {
UninterpretedOption$NamePart({String? namePart, bool? isExtension}) {
if (namePart != null) $values[$fields.namePart] = namePart;
if (isExtension != null) $values[$fields.isExtension] = isExtension;
}
static final $fields = (
namePart: ProtoField<String>(1, 'name_part', ''),
isExtension: ProtoField<bool>(2, 'is_extension', false),
);
String get namePart => $value($fields.namePart);
bool get isExtension => $value($fields.isExtension);
}
/// TODO Enums in C++ gencode (and potentially other languages) are
/// not well scoped. This means that each of the feature enums below can clash
/// with each other. The short names we've chosen maximize call-site
/// readability, but leave us very open to this scenario. A future feature will
/// be designed and implemented to handle this, hopefully before we ever hit a
/// conflict here.
class FeatureSet extends ProtoMessage {
FeatureSet({
FeatureSet$FieldPresence? fieldPresence,
FeatureSet$EnumType? enumType,
FeatureSet$RepeatedFieldEncoding? repeatedFieldEncoding,
FeatureSet$Utf8Validation? utf8Validation,
FeatureSet$MessageEncoding? messageEncoding,
FeatureSet$JsonFormat? jsonFormat,
FeatureSet$EnforceNamingStyle? enforceNamingStyle,
}) {
if (fieldPresence != null) $values[$fields.fieldPresence] = fieldPresence;
if (enumType != null) $values[$fields.enumType] = enumType;
if (repeatedFieldEncoding != null) {
$values[$fields.repeatedFieldEncoding] = repeatedFieldEncoding;
}
if (utf8Validation != null) {
$values[$fields.utf8Validation] = utf8Validation;
}
if (messageEncoding != null) {
$values[$fields.messageEncoding] = messageEncoding;
}
if (jsonFormat != null) $values[$fields.jsonFormat] = jsonFormat;
if (enforceNamingStyle != null) {
$values[$fields.enforceNamingStyle] = enforceNamingStyle;
}
}
static final $fields = (
fieldPresence: ProtoField<FeatureSet$FieldPresence>(
1,
'field_presence',
FeatureSet$FieldPresence.FIELD_PRESENCE_UNKNOWN,
),
enumType: ProtoField<FeatureSet$EnumType>(
2,
'enum_type',
FeatureSet$EnumType.ENUM_TYPE_UNKNOWN,
),
repeatedFieldEncoding: ProtoField<FeatureSet$RepeatedFieldEncoding>(
3,
'repeated_field_encoding',
FeatureSet$RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN,
),
utf8Validation: ProtoField<FeatureSet$Utf8Validation>(
4,
'utf8_validation',
FeatureSet$Utf8Validation.UTF8_VALIDATION_UNKNOWN,
),
messageEncoding: ProtoField<FeatureSet$MessageEncoding>(
5,
'message_encoding',
FeatureSet$MessageEncoding.MESSAGE_ENCODING_UNKNOWN,
),
jsonFormat: ProtoField<FeatureSet$JsonFormat>(
6,
'json_format',
FeatureSet$JsonFormat.JSON_FORMAT_UNKNOWN,
),
enforceNamingStyle: ProtoField<FeatureSet$EnforceNamingStyle>(
7,
'enforce_naming_style',
FeatureSet$EnforceNamingStyle.ENFORCE_NAMING_STYLE_UNKNOWN,
),
);
FeatureSet$FieldPresence get fieldPresence => $value($fields.fieldPresence);
FeatureSet$EnumType get enumType => $value($fields.enumType);
FeatureSet$RepeatedFieldEncoding get repeatedFieldEncoding =>
$value($fields.repeatedFieldEncoding);
FeatureSet$Utf8Validation get utf8Validation =>
$value($fields.utf8Validation);
FeatureSet$MessageEncoding get messageEncoding =>
$value($fields.messageEncoding);
FeatureSet$JsonFormat get jsonFormat => $value($fields.jsonFormat);
FeatureSet$EnforceNamingStyle get enforceNamingStyle =>
$value($fields.enforceNamingStyle);
}
class FeatureSet$FieldPresence extends ProtoEnum {
const FeatureSet$FieldPresence(super.$value, super.name);
static const List<FeatureSet$FieldPresence> values = [
FIELD_PRESENCE_UNKNOWN,
EXPLICIT,
IMPLICIT,
LEGACY_REQUIRED,
];
static const FIELD_PRESENCE_UNKNOWN = FeatureSet$FieldPresence(
0,
'FIELD_PRESENCE_UNKNOWN',
);
static const EXPLICIT = FeatureSet$FieldPresence(1, 'EXPLICIT');
static const IMPLICIT = FeatureSet$FieldPresence(2, 'IMPLICIT');
static const LEGACY_REQUIRED = FeatureSet$FieldPresence(3, 'LEGACY_REQUIRED');
}
class FeatureSet$EnumType extends ProtoEnum {
const FeatureSet$EnumType(super.$value, super.name);
static const List<FeatureSet$EnumType> values = [
ENUM_TYPE_UNKNOWN,
OPEN,
CLOSED,
];
static const ENUM_TYPE_UNKNOWN = FeatureSet$EnumType(0, 'ENUM_TYPE_UNKNOWN');
static const OPEN = FeatureSet$EnumType(1, 'OPEN');
static const CLOSED = FeatureSet$EnumType(2, 'CLOSED');
}
class FeatureSet$RepeatedFieldEncoding extends ProtoEnum {
const FeatureSet$RepeatedFieldEncoding(super.$value, super.name);
static const List<FeatureSet$RepeatedFieldEncoding> values = [
REPEATED_FIELD_ENCODING_UNKNOWN,
PACKED,
EXPANDED,
];
static const REPEATED_FIELD_ENCODING_UNKNOWN =
FeatureSet$RepeatedFieldEncoding(0, 'REPEATED_FIELD_ENCODING_UNKNOWN');
static const PACKED = FeatureSet$RepeatedFieldEncoding(1, 'PACKED');
static const EXPANDED = FeatureSet$RepeatedFieldEncoding(2, 'EXPANDED');
}
class FeatureSet$Utf8Validation extends ProtoEnum {
const FeatureSet$Utf8Validation(super.$value, super.name);
static const List<FeatureSet$Utf8Validation> values = [
UTF8_VALIDATION_UNKNOWN,
VERIFY,
NONE,
];
static const UTF8_VALIDATION_UNKNOWN = FeatureSet$Utf8Validation(
0,
'UTF8_VALIDATION_UNKNOWN',
);
static const VERIFY = FeatureSet$Utf8Validation(2, 'VERIFY');
static const NONE = FeatureSet$Utf8Validation(3, 'NONE');
}
class FeatureSet$MessageEncoding extends ProtoEnum {
const FeatureSet$MessageEncoding(super.$value, super.name);
static const List<FeatureSet$MessageEncoding> values = [
MESSAGE_ENCODING_UNKNOWN,
LENGTH_PREFIXED,
DELIMITED,
];
static const MESSAGE_ENCODING_UNKNOWN = FeatureSet$MessageEncoding(
0,
'MESSAGE_ENCODING_UNKNOWN',
);
static const LENGTH_PREFIXED = FeatureSet$MessageEncoding(
1,
'LENGTH_PREFIXED',
);
static const DELIMITED = FeatureSet$MessageEncoding(2, 'DELIMITED');
}
class FeatureSet$JsonFormat extends ProtoEnum {
const FeatureSet$JsonFormat(super.$value, super.name);
static const List<FeatureSet$JsonFormat> values = [
JSON_FORMAT_UNKNOWN,
ALLOW,
LEGACY_BEST_EFFORT,
];
static const JSON_FORMAT_UNKNOWN = FeatureSet$JsonFormat(
0,
'JSON_FORMAT_UNKNOWN',
);
static const ALLOW = FeatureSet$JsonFormat(1, 'ALLOW');
static const LEGACY_BEST_EFFORT = FeatureSet$JsonFormat(
2,
'LEGACY_BEST_EFFORT',
);
}
class FeatureSet$EnforceNamingStyle extends ProtoEnum {
const FeatureSet$EnforceNamingStyle(super.$value, super.name);
static const List<FeatureSet$EnforceNamingStyle> values = [
ENFORCE_NAMING_STYLE_UNKNOWN,
STYLE2024,
STYLE_LEGACY,
];
static const ENFORCE_NAMING_STYLE_UNKNOWN = FeatureSet$EnforceNamingStyle(
0,
'ENFORCE_NAMING_STYLE_UNKNOWN',
);
static const STYLE2024 = FeatureSet$EnforceNamingStyle(1, 'STYLE2024');
static const STYLE_LEGACY = FeatureSet$EnforceNamingStyle(2, 'STYLE_LEGACY');
}
/// A compiled specification for the defaults of a set of features. These
/// messages are generated from FeatureSet extensions and can be used to seed
/// feature resolution. The resolution with this object becomes a simple search
/// for the closest matching edition, followed by proto merges.
class FeatureSetDefaults extends ProtoMessage {
FeatureSetDefaults({
List<FeatureSetDefaults$FeatureSetEditionDefault>? defaults,
Edition? minimumEdition,
Edition? maximumEdition,
}) {
if (defaults != null) $values[$fields.defaults] = defaults;
if (minimumEdition != null) {
$values[$fields.minimumEdition] = minimumEdition;
}
if (maximumEdition != null) {
$values[$fields.maximumEdition] = maximumEdition;
}
}
static final $fields = (
defaults: ProtoField<FeatureSetDefaults$FeatureSetEditionDefault>(
1,
'defaults',
),
minimumEdition: ProtoField<Edition>(
4,
'minimum_edition',
Edition.EDITION_UNKNOWN,
),
maximumEdition: ProtoField<Edition>(
5,
'maximum_edition',
Edition.EDITION_UNKNOWN,
),
);
List<FeatureSetDefaults$FeatureSetEditionDefault> get defaults =>
$value($fields.defaults);
/// The minimum supported edition (inclusive) when this was constructed.
/// Editions before this will not have defaults.
Edition get minimumEdition => $value($fields.minimumEdition);
/// The maximum known edition (inclusive) when this was constructed. Editions
/// after this will not have reliable defaults.
Edition get maximumEdition => $value($fields.maximumEdition);
}
/// A map from every known edition with a unique set of defaults to its
/// defaults. Not all editions may be contained here. For a given edition,
/// the defaults at the closest matching edition ordered at or before it should
/// be used. This field must be in strict ascending order by edition.
class FeatureSetDefaults$FeatureSetEditionDefault extends ProtoMessage {
FeatureSetDefaults$FeatureSetEditionDefault({
Edition? edition,
FeatureSet? overridableFeatures,
FeatureSet? fixedFeatures,
}) {
if (edition != null) $values[$fields.edition] = edition;
if (overridableFeatures != null) {
$values[$fields.overridableFeatures] = overridableFeatures;
}
if (fixedFeatures != null) $values[$fields.fixedFeatures] = fixedFeatures;
}
static final $fields = (
edition: ProtoField<Edition>(3, 'edition', Edition.EDITION_UNKNOWN),
overridableFeatures: ProtoField<FeatureSet>(4, 'overridable_features'),
fixedFeatures: ProtoField<FeatureSet>(5, 'fixed_features'),
);
Edition get edition => $value($fields.edition);
/// Defaults of features that can be overridden in this edition.
FeatureSet? get overridableFeatures => $value($fields.overridableFeatures);
/// Defaults of features that can't be overridden in this edition.
FeatureSet? get fixedFeatures => $value($fields.fixedFeatures);
}
/// Encapsulates information about the original source file from which a
/// FileDescriptorProto was generated.
class SourceCodeInfo extends ProtoMessage {
SourceCodeInfo({List<SourceCodeInfo$Location>? location}) {
if (location != null) $values[$fields.location] = location;
}
static final $fields = (
location: ProtoField<SourceCodeInfo$Location>(1, 'location'),
);
/// A Location identifies a piece of source code in a .proto file which
/// corresponds to a particular definition. This information is intended
/// to be useful to IDEs, code indexers, documentation generators, and similar
/// tools.
///
/// For example, say we have a file like:
/// message Foo {
/// optional string foo = 1;
/// }
/// Let's look at just the field definition:
/// optional string foo = 1;
/// ^ ^^ ^^ ^ ^^^
/// a bc de f ghi
/// We have the following locations:
/// span path represents
/// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
/// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
/// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
/// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
/// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
///
/// Notes:
/// - A location may refer to a repeated field itself (i.e. not to any
/// particular index within it). This is used whenever a set of elements are
/// logically enclosed in a single code segment. For example, an entire
/// extend block (possibly containing multiple extension definitions) will
/// have an outer location whose path refers to the "extensions" repeated
/// field without an index.
/// - Multiple locations may have the same path. This happens when a single
/// logical declaration is spread out across multiple places. The most
/// obvious example is the "extend" block again -- there may be multiple
/// extend blocks in the same scope, each of which will have the same path.
/// - A location's span is not always a subset of its parent's span. For
/// example, the "extendee" of an extension declaration appears at the
/// beginning of the "extend" block and is shared by all extensions within
/// the block.
/// - Just because a location's span is a subset of some other location's span
/// does not mean that it is a descendant. For example, a "group" defines
/// both a type and a field in a single declaration. Thus, the locations
/// corresponding to the type and field and their components will overlap.
/// - Code which tries to interpret locations should probably be designed to
/// ignore those that it doesn't understand, as more types of locations could
/// be recorded in the future.
List<SourceCodeInfo$Location> get location => $value($fields.location);
}
class SourceCodeInfo$Location extends ProtoMessage {
SourceCodeInfo$Location({
List<int>? path,
List<int>? span,
String? leadingComments,
String? trailingComments,
List<String>? leadingDetachedComments,
}) {
if (path != null) $values[$fields.path] = path;
if (span != null) $values[$fields.span] = span;
if (leadingComments != null) {
$values[$fields.leadingComments] = leadingComments;
}
if (trailingComments != null) {
$values[$fields.trailingComments] = trailingComments;
}
if (leadingDetachedComments != null) {
$values[$fields.leadingDetachedComments] = leadingDetachedComments;
}
}
static final $fields = (
path: ProtoField<int>(1, 'path', 0),
span: ProtoField<int>(2, 'span', 0),
leadingComments: ProtoField<String>(3, 'leading_comments', ''),
trailingComments: ProtoField<String>(4, 'trailing_comments', ''),
leadingDetachedComments: ProtoField<String>(
6,
'leading_detached_comments',
'',
),
);
/// Identifies which part of the FileDescriptorProto was defined at this
/// location.
///
/// Each element is a field number or an index. They form a path from
/// the root FileDescriptorProto to the place where the definition appears.
/// For example, this path:
/// [ 4, 3, 2, 7, 1 ]
/// refers to:
/// file.message_type(3) // 4, 3
/// .field(7) // 2, 7
/// .name() // 1
/// This is because FileDescriptorProto.message_type has field number 4:
/// repeated DescriptorProto message_type = 4;
/// and DescriptorProto.field has field number 2:
/// repeated FieldDescriptorProto field = 2;
/// and FieldDescriptorProto.name has field number 1:
/// optional string name = 1;
///
/// Thus, the above path gives the location of a field name. If we removed
/// the last element:
/// [ 4, 3, 2, 7 ]
/// this path refers to the whole field declaration (from the beginning
/// of the label to the terminating semicolon).
List<int> get path => $value($fields.path);
/// Always has exactly three or four elements: start line, start column,
/// end line (optional, otherwise assumed same as start line), end column.
/// These are packed into a single field for efficiency. Note that line
/// and column numbers are zero-based -- typically you will want to add
/// 1 to each before displaying to a user.
List<int> get span => $value($fields.span);
/// If this SourceCodeInfo represents a complete declaration, these are any
/// comments appearing before and after the declaration which appear to be
/// attached to the declaration.
///
/// A series of line comments appearing on consecutive lines, with no other
/// tokens appearing on those lines, will be treated as a single comment.
///
/// leading_detached_comments will keep paragraphs of comments that appear
/// before (but not connected to) the current element. Each paragraph,
/// separated by empty lines, will be one comment element in the repeated
/// field.
///
/// Only the comment content is provided; comment markers (e.g. //) are
/// stripped out. For block comments, leading whitespace and an asterisk
/// will be stripped from the beginning of each line other than the first.
/// Newlines are included in the output.
///
/// Examples:
///
/// optional int32 foo = 1; // Comment attached to foo.
/// // Comment attached to bar.
/// optional int32 bar = 2;
///
/// optional string baz = 3;
/// // Comment attached to baz.
/// // Another line attached to baz.
///
/// // Comment attached to moo.
/// //
/// // Another line attached to moo.
/// optional double moo = 4;
///
/// // Detached comment for corge. This is not leading or trailing comments
/// // to moo or corge because there are blank lines separating it from
/// // both.
///
/// // Detached comment for corge paragraph 2.
///
/// optional string corge = 5;
/// /* Block comment attached
/// * to corge. Leading asterisks
/// * will be removed. */
/// /* Block comment attached to
/// * grault. */
/// optional int32 grault = 6;
///
/// // ignored detached comments.
String get leadingComments => $value($fields.leadingComments);
String get trailingComments => $value($fields.trailingComments);
List<String> get leadingDetachedComments =>
$value($fields.leadingDetachedComments);
}
/// Describes the relationship between generated code and its original source
/// file. A GeneratedCodeInfo message is associated with only one generated
/// source file, but may contain references to different source .proto files.
class GeneratedCodeInfo extends ProtoMessage {
GeneratedCodeInfo({List<GeneratedCodeInfo$Annotation>? annotation}) {
if (annotation != null) $values[$fields.annotation] = annotation;
}
static final $fields = (
annotation: ProtoField<GeneratedCodeInfo$Annotation>(1, 'annotation'),
);
/// An Annotation connects some span of text in generated code to an element
/// of its generating .proto file.
List<GeneratedCodeInfo$Annotation> get annotation =>
$value($fields.annotation);
}
class GeneratedCodeInfo$Annotation extends ProtoMessage {
GeneratedCodeInfo$Annotation({
List<int>? path,
String? sourceFile,
int? begin,
int? end,
GeneratedCodeInfo$Annotation$Semantic? semantic,
}) {
if (path != null) $values[$fields.path] = path;
if (sourceFile != null) $values[$fields.sourceFile] = sourceFile;
if (begin != null) $values[$fields.begin] = begin;
if (end != null) $values[$fields.end] = end;
if (semantic != null) $values[$fields.semantic] = semantic;
}
static final $fields = (
path: ProtoField<int>(1, 'path', 0),
sourceFile: ProtoField<String>(2, 'source_file', ''),
begin: ProtoField<int>(3, 'begin', 0),
end: ProtoField<int>(4, 'end', 0),
semantic: ProtoField<GeneratedCodeInfo$Annotation$Semantic>(
5,
'semantic',
GeneratedCodeInfo$Annotation$Semantic.NONE,
),
);
/// Identifies the element in the original source .proto file. This field
/// is formatted the same as SourceCodeInfo.Location.path.
List<int> get path => $value($fields.path);
/// Identifies the filesystem path to the original source .proto.
String get sourceFile => $value($fields.sourceFile);
/// Identifies the starting offset in bytes in the generated code
/// that relates to the identified object.
int get begin => $value($fields.begin);
/// Identifies the ending offset in bytes in the generated code that
/// relates to the identified object. The end offset should be one past
/// the last relevant byte (so the length of the text = end - begin).
int get end => $value($fields.end);
GeneratedCodeInfo$Annotation$Semantic get semantic =>
$value($fields.semantic);
}
/// Represents the identified object's effect on the element in the original
/// .proto file.
class GeneratedCodeInfo$Annotation$Semantic extends ProtoEnum {
const GeneratedCodeInfo$Annotation$Semantic(super.$value, super.name);
static const List<GeneratedCodeInfo$Annotation$Semantic> values = [
NONE,
SET,
ALIAS,
];
/// There is no effect or the effect is indescribable.
static const NONE = GeneratedCodeInfo$Annotation$Semantic(0, 'NONE');
/// The element is set or otherwise mutated.
static const SET = GeneratedCodeInfo$Annotation$Semantic(1, 'SET');
/// An alias to the element is returned.
static const ALIAS = GeneratedCodeInfo$Annotation$Semantic(2, 'ALIAS');
}
/// The full set of known editions.
class Edition extends ProtoEnum {
const Edition(super.$value, super.name);
static const List<Edition> values = [
EDITION_UNKNOWN,
EDITION_LEGACY,
EDITION_PROTO2,
EDITION_PROTO3,
EDITION_2023,
EDITION_2024,
EDITION_1_TEST_ONLY,
EDITION_2_TEST_ONLY,
EDITION_99997_TEST_ONLY,
EDITION_99998_TEST_ONLY,
EDITION_99999_TEST_ONLY,
EDITION_MAX,
];
/// A placeholder for an unknown edition value.
static const EDITION_UNKNOWN = Edition(0, 'EDITION_UNKNOWN');
/// A placeholder edition for specifying default behaviors *before* a feature
/// was first introduced. This is effectively an "infinite past".
static const EDITION_LEGACY = Edition(900, 'EDITION_LEGACY');
/// Legacy syntax "editions". These pre-date editions, but behave much like
/// distinct editions. These can't be used to specify the edition of proto
/// files, but feature definitions must supply proto2/proto3 defaults for
/// backwards compatibility.
static const EDITION_PROTO2 = Edition(998, 'EDITION_PROTO2');
static const EDITION_PROTO3 = Edition(999, 'EDITION_PROTO3');
/// Editions that have been released. The specific values are arbitrary and
/// should not be depended on, but they will always be time-ordered for easy
/// comparison.
static const EDITION_2023 = Edition(1000, 'EDITION_2023');
static const EDITION_2024 = Edition(1001, 'EDITION_2024');
/// Placeholder editions for testing feature resolution. These should not be
/// used or relied on outside of tests.
static const EDITION_1_TEST_ONLY = Edition(1, 'EDITION_1_TEST_ONLY');
static const EDITION_2_TEST_ONLY = Edition(2, 'EDITION_2_TEST_ONLY');
static const EDITION_99997_TEST_ONLY = Edition(
99997,
'EDITION_99997_TEST_ONLY',
);
static const EDITION_99998_TEST_ONLY = Edition(
99998,
'EDITION_99998_TEST_ONLY',
);
static const EDITION_99999_TEST_ONLY = Edition(
99999,
'EDITION_99999_TEST_ONLY',
);
/// Placeholder for specifying unbounded edition support. This should only
/// ever be used by plugins that can expect to never require any changes to
/// support a new edition.
static const EDITION_MAX = Edition(2147483647, 'EDITION_MAX');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment