diff --git a/integration/options-types-only/google/protobuf/descriptor.ts b/integration/options-types-only/google/protobuf/descriptor.ts new file mode 100644 index 000000000..812d0b3fe --- /dev/null +++ b/integration/options-types-only/google/protobuf/descriptor.ts @@ -0,0 +1,3758 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// source: google/protobuf/descriptor.proto + +/* eslint-disable */ +import { FileDescriptorProto as FileDescriptorProto1 } from "ts-proto-descriptors"; + +export const protobufPackage = "google.protobuf"; + +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name?: + | string + | undefined; + /** e.g. "foo", "foo.bar", etc. */ + package?: + | string + | undefined; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: + | FileOptions + | undefined; + /** + * 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?: + | SourceCodeInfo + | undefined; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax?: string | undefined; +} + +/** Describes a message type. */ +export interface DescriptorProto { + name?: string | undefined; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions | undefined; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; +} + +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Exclusive. */ + end?: number | undefined; + options?: ExtensionRangeOptions | undefined; +} + +/** + * 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. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Exclusive. */ + end?: number | undefined; +} + +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name?: string | undefined; + number?: number | undefined; + label?: + | FieldDescriptorProto_Label + | undefined; + /** + * 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. + */ + type?: + | FieldDescriptorProto_Type + | undefined; + /** + * 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). + */ + typeName?: + | string + | undefined; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee?: + | string + | undefined; + /** + * 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. + * TODO(kenton): Base-64 encode? + */ + defaultValue?: + | string + | undefined; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex?: + | number + | undefined; + /** + * 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. + */ + jsonName?: string | undefined; + options?: + | FieldOptions + | undefined; + /** + * 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 be 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`. + */ + proto3Optional?: boolean | undefined; +} + +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} + +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} + +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name?: string | undefined; + options?: OneofOptions | undefined; +} + +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name?: string | undefined; + value: EnumValueDescriptorProto[]; + options?: + | EnumOptions + | undefined; + /** + * 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. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} + +/** + * 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. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start?: + | number + | undefined; + /** Inclusive. */ + end?: number | undefined; +} + +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name?: string | undefined; + number?: number | undefined; + options?: EnumValueOptions | undefined; +} + +/** Describes a service. */ +export interface ServiceDescriptorProto { + name?: string | undefined; + method: MethodDescriptorProto[]; + options?: ServiceOptions | undefined; +} + +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name?: + | string + | undefined; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType?: string | undefined; + outputType?: string | undefined; + options?: + | MethodOptions + | undefined; + /** Identifies if client streams multiple client messages */ + clientStreaming?: + | boolean + | undefined; + /** Identifies if server streams multiple server messages */ + serverStreaming?: boolean | undefined; +} + +export interface FileOptions { + /** + * 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. + */ + javaPackage?: + | string + | undefined; + /** + * 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. + */ + javaOuterClassname?: + | string + | undefined; + /** + * 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. + */ + javaMultipleFiles?: + | boolean + | undefined; + /** + * This option does nothing. + * + * @deprecated + */ + javaGenerateEqualsAndHash?: + | boolean + | undefined; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + javaStringCheckUtf8?: boolean | undefined; + optimizeFor?: + | FileOptions_OptimizeMode + | undefined; + /** + * 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. + */ + goPackage?: + | string + | undefined; + /** + * 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. + */ + ccGenericServices?: boolean | undefined; + javaGenericServices?: boolean | undefined; + pyGenericServices?: boolean | undefined; + phpGenericServices?: + | boolean + | undefined; + /** + * 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. + */ + deprecated?: + | boolean + | undefined; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas?: + | boolean + | undefined; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix?: + | string + | undefined; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace?: + | string + | undefined; + /** + * 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. + */ + swiftPrefix?: + | string + | undefined; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix?: + | string + | undefined; + /** + * 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. + */ + phpNamespace?: + | string + | undefined; + /** + * 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. + */ + phpMetadataNamespace?: + | string + | undefined; + /** + * 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. + */ + rubyPackage?: + | string + | undefined; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} + +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} + +export interface MessageOptions { + /** + * 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. + */ + messageSetWireFormat?: + | boolean + | undefined; + /** + * 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". + */ + noStandardDescriptorAccessor?: + | boolean + | undefined; + /** + * 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. + */ + deprecated?: + | boolean + | undefined; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map 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. + */ + mapEntry?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * 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 not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype?: + | FieldOptions_CType + | undefined; + /** + * 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. + */ + packed?: + | boolean + | undefined; + /** + * 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. + */ + jstype?: + | FieldOptions_JSType + | undefined; + /** + * 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 implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + lazy?: + | boolean + | undefined; + /** + * 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. + */ + deprecated?: + | boolean + | undefined; + /** For Google-internal migration only. Do not use. */ + weak?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} + +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias?: + | boolean + | undefined; + /** + * 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. + */ + deprecated?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * 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. + */ + deprecated?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** + * 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. + */ + deprecated?: + | boolean + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * 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. + */ + deprecated?: boolean | undefined; + idempotencyLevel?: + | MethodOptions_IdempotencyLevel + | undefined; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: 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. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} + +/** + * 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. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue?: string | undefined; + positiveIntValue?: number | undefined; + negativeIntValue?: number | undefined; + doubleValue?: number | undefined; + stringValue?: Uint8Array | undefined; + aggregateValue?: string | undefined; +} + +/** + * 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], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} + +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * 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. + */ + location: SourceCodeInfo_Location[]; +} + +export interface SourceCodeInfo_Location { + /** + * 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. 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). + */ + path: number[]; + /** + * 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. + */ + span: number[]; + /** + * 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 qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux 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. + */ + leadingComments?: string | undefined; + trailingComments?: string | undefined; + leadingDetachedComments: string[]; +} + +/** + * 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. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} + +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile?: + | string + | undefined; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin?: + | number + | undefined; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number | undefined; +} + +type ProtoMetaMessageOptions = { + options?: { [key: string]: any }; + fields?: { [key: string]: { [key: string]: any } }; + oneof?: { [key: string]: { [key: string]: any } }; + nested?: { [key: string]: ProtoMetaMessageOptions }; +}; + +export interface ProtoMetadata { + fileDescriptor: FileDescriptorProto1; + references: { [key: string]: any }; + dependencies?: ProtoMetadata[]; + options?: { + options?: { [key: string]: any }; + services?: { + [key: string]: { options?: { [key: string]: any }; methods?: { [key: string]: { [key: string]: any } } }; + }; + messages?: { [key: string]: ProtoMetaMessageOptions }; + enums?: { [key: string]: { options?: { [key: string]: any }; values?: { [key: string]: { [key: string]: any } } } }; + }; +} + +export const protoMetadata: ProtoMetadata = { + fileDescriptor: FileDescriptorProto1.fromPartial({ + "name": "google/protobuf/descriptor.proto", + "package": "google.protobuf", + "dependency": [], + "publicDependency": [], + "weakDependency": [], + "messageType": [{ + "name": "FileDescriptorSet", + "field": [{ + "name": "file", + "number": 1, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.FileDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "file", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "FileDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "package", + "number": 2, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "package", + "options": undefined, + "proto3Optional": false, + }, { + "name": "dependency", + "number": 3, + "label": 3, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "dependency", + "options": undefined, + "proto3Optional": false, + }, { + "name": "public_dependency", + "number": 10, + "label": 3, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "publicDependency", + "options": undefined, + "proto3Optional": false, + }, { + "name": "weak_dependency", + "number": 11, + "label": 3, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "weakDependency", + "options": undefined, + "proto3Optional": false, + }, { + "name": "message_type", + "number": 4, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.DescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "messageType", + "options": undefined, + "proto3Optional": false, + }, { + "name": "enum_type", + "number": 5, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.EnumDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "enumType", + "options": undefined, + "proto3Optional": false, + }, { + "name": "service", + "number": 6, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.ServiceDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "service", + "options": undefined, + "proto3Optional": false, + }, { + "name": "extension", + "number": 7, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.FieldDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "extension", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 8, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.FileOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }, { + "name": "source_code_info", + "number": 9, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.SourceCodeInfo", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "sourceCodeInfo", + "options": undefined, + "proto3Optional": false, + }, { + "name": "syntax", + "number": 12, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "syntax", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "DescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "field", + "number": 2, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.FieldDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "field", + "options": undefined, + "proto3Optional": false, + }, { + "name": "extension", + "number": 6, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.FieldDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "extension", + "options": undefined, + "proto3Optional": false, + }, { + "name": "nested_type", + "number": 3, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.DescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "nestedType", + "options": undefined, + "proto3Optional": false, + }, { + "name": "enum_type", + "number": 4, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.EnumDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "enumType", + "options": undefined, + "proto3Optional": false, + }, { + "name": "extension_range", + "number": 5, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.DescriptorProto.ExtensionRange", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "extensionRange", + "options": undefined, + "proto3Optional": false, + }, { + "name": "oneof_decl", + "number": 8, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.OneofDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "oneofDecl", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 7, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.MessageOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }, { + "name": "reserved_range", + "number": 9, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.DescriptorProto.ReservedRange", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "reservedRange", + "options": undefined, + "proto3Optional": false, + }, { + "name": "reserved_name", + "number": 10, + "label": 3, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "reservedName", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [{ + "name": "ExtensionRange", + "field": [{ + "name": "start", + "number": 1, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "start", + "options": undefined, + "proto3Optional": false, + }, { + "name": "end", + "number": 2, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "end", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 3, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.ExtensionRangeOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "ReservedRange", + "field": [{ + "name": "start", + "number": 1, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "start", + "options": undefined, + "proto3Optional": false, + }, { + "name": "end", + "number": 2, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "end", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "ExtensionRangeOptions", + "field": [{ + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "FieldDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "number", + "number": 3, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "number", + "options": undefined, + "proto3Optional": false, + }, { + "name": "label", + "number": 4, + "label": 1, + "type": 14, + "typeName": ".google.protobuf.FieldDescriptorProto.Label", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "label", + "options": undefined, + "proto3Optional": false, + }, { + "name": "type", + "number": 5, + "label": 1, + "type": 14, + "typeName": ".google.protobuf.FieldDescriptorProto.Type", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "type", + "options": undefined, + "proto3Optional": false, + }, { + "name": "type_name", + "number": 6, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "typeName", + "options": undefined, + "proto3Optional": false, + }, { + "name": "extendee", + "number": 2, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "extendee", + "options": undefined, + "proto3Optional": false, + }, { + "name": "default_value", + "number": 7, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "defaultValue", + "options": undefined, + "proto3Optional": false, + }, { + "name": "oneof_index", + "number": 9, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "oneofIndex", + "options": undefined, + "proto3Optional": false, + }, { + "name": "json_name", + "number": 10, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "jsonName", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 8, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.FieldOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }, { + "name": "proto3_optional", + "number": 17, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "proto3Optional", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [{ + "name": "Type", + "value": [ + { "name": "TYPE_DOUBLE", "number": 1, "options": undefined }, + { "name": "TYPE_FLOAT", "number": 2, "options": undefined }, + { "name": "TYPE_INT64", "number": 3, "options": undefined }, + { "name": "TYPE_UINT64", "number": 4, "options": undefined }, + { "name": "TYPE_INT32", "number": 5, "options": undefined }, + { "name": "TYPE_FIXED64", "number": 6, "options": undefined }, + { "name": "TYPE_FIXED32", "number": 7, "options": undefined }, + { "name": "TYPE_BOOL", "number": 8, "options": undefined }, + { "name": "TYPE_STRING", "number": 9, "options": undefined }, + { "name": "TYPE_GROUP", "number": 10, "options": undefined }, + { "name": "TYPE_MESSAGE", "number": 11, "options": undefined }, + { "name": "TYPE_BYTES", "number": 12, "options": undefined }, + { "name": "TYPE_UINT32", "number": 13, "options": undefined }, + { "name": "TYPE_ENUM", "number": 14, "options": undefined }, + { "name": "TYPE_SFIXED32", "number": 15, "options": undefined }, + { "name": "TYPE_SFIXED64", "number": 16, "options": undefined }, + { "name": "TYPE_SINT32", "number": 17, "options": undefined }, + { "name": "TYPE_SINT64", "number": 18, "options": undefined }, + ], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "Label", + "value": [{ "name": "LABEL_OPTIONAL", "number": 1, "options": undefined }, { + "name": "LABEL_REQUIRED", + "number": 2, + "options": undefined, + }, { "name": "LABEL_REPEATED", "number": 3, "options": undefined }], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "OneofDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 2, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.OneofOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "EnumDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "value", + "number": 2, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.EnumValueDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "value", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 3, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.EnumOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }, { + "name": "reserved_range", + "number": 4, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.EnumDescriptorProto.EnumReservedRange", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "reservedRange", + "options": undefined, + "proto3Optional": false, + }, { + "name": "reserved_name", + "number": 5, + "label": 3, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "reservedName", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [{ + "name": "EnumReservedRange", + "field": [{ + "name": "start", + "number": 1, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "start", + "options": undefined, + "proto3Optional": false, + }, { + "name": "end", + "number": 2, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "end", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "EnumValueDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "number", + "number": 2, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "number", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 3, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.EnumValueOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "ServiceDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "method", + "number": 2, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.MethodDescriptorProto", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "method", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 3, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.ServiceOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "MethodDescriptorProto", + "field": [{ + "name": "name", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "input_type", + "number": 2, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "inputType", + "options": undefined, + "proto3Optional": false, + }, { + "name": "output_type", + "number": 3, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "outputType", + "options": undefined, + "proto3Optional": false, + }, { + "name": "options", + "number": 4, + "label": 1, + "type": 11, + "typeName": ".google.protobuf.MethodOptions", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "options", + "options": undefined, + "proto3Optional": false, + }, { + "name": "client_streaming", + "number": 5, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "clientStreaming", + "options": undefined, + "proto3Optional": false, + }, { + "name": "server_streaming", + "number": 6, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "serverStreaming", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "FileOptions", + "field": [{ + "name": "java_package", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "javaPackage", + "options": undefined, + "proto3Optional": false, + }, { + "name": "java_outer_classname", + "number": 8, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "javaOuterClassname", + "options": undefined, + "proto3Optional": false, + }, { + "name": "java_multiple_files", + "number": 10, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "javaMultipleFiles", + "options": undefined, + "proto3Optional": false, + }, { + "name": "java_generate_equals_and_hash", + "number": 20, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "javaGenerateEqualsAndHash", + "options": { + "ctype": 0, + "packed": false, + "jstype": 0, + "lazy": false, + "deprecated": true, + "weak": false, + "uninterpretedOption": [], + }, + "proto3Optional": false, + }, { + "name": "java_string_check_utf8", + "number": 27, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "javaStringCheckUtf8", + "options": undefined, + "proto3Optional": false, + }, { + "name": "optimize_for", + "number": 9, + "label": 1, + "type": 14, + "typeName": ".google.protobuf.FileOptions.OptimizeMode", + "extendee": "", + "defaultValue": "SPEED", + "oneofIndex": 0, + "jsonName": "optimizeFor", + "options": undefined, + "proto3Optional": false, + }, { + "name": "go_package", + "number": 11, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "goPackage", + "options": undefined, + "proto3Optional": false, + }, { + "name": "cc_generic_services", + "number": 16, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "ccGenericServices", + "options": undefined, + "proto3Optional": false, + }, { + "name": "java_generic_services", + "number": 17, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "javaGenericServices", + "options": undefined, + "proto3Optional": false, + }, { + "name": "py_generic_services", + "number": 18, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "pyGenericServices", + "options": undefined, + "proto3Optional": false, + }, { + "name": "php_generic_services", + "number": 42, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "phpGenericServices", + "options": undefined, + "proto3Optional": false, + }, { + "name": "deprecated", + "number": 23, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "cc_enable_arenas", + "number": 31, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "true", + "oneofIndex": 0, + "jsonName": "ccEnableArenas", + "options": undefined, + "proto3Optional": false, + }, { + "name": "objc_class_prefix", + "number": 36, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "objcClassPrefix", + "options": undefined, + "proto3Optional": false, + }, { + "name": "csharp_namespace", + "number": 37, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "csharpNamespace", + "options": undefined, + "proto3Optional": false, + }, { + "name": "swift_prefix", + "number": 39, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "swiftPrefix", + "options": undefined, + "proto3Optional": false, + }, { + "name": "php_class_prefix", + "number": 40, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "phpClassPrefix", + "options": undefined, + "proto3Optional": false, + }, { + "name": "php_namespace", + "number": 41, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "phpNamespace", + "options": undefined, + "proto3Optional": false, + }, { + "name": "php_metadata_namespace", + "number": 44, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "phpMetadataNamespace", + "options": undefined, + "proto3Optional": false, + }, { + "name": "ruby_package", + "number": 45, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "rubyPackage", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [{ + "name": "OptimizeMode", + "value": [{ "name": "SPEED", "number": 1, "options": undefined }, { + "name": "CODE_SIZE", + "number": 2, + "options": undefined, + }, { "name": "LITE_RUNTIME", "number": 3, "options": undefined }], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [{ "start": 38, "end": 39 }], + "reservedName": [], + }, { + "name": "MessageOptions", + "field": [{ + "name": "message_set_wire_format", + "number": 1, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "messageSetWireFormat", + "options": undefined, + "proto3Optional": false, + }, { + "name": "no_standard_descriptor_accessor", + "number": 2, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "noStandardDescriptorAccessor", + "options": undefined, + "proto3Optional": false, + }, { + "name": "deprecated", + "number": 3, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "map_entry", + "number": 7, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "mapEntry", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [{ "start": 4, "end": 5 }, { "start": 5, "end": 6 }, { "start": 6, "end": 7 }, { + "start": 8, + "end": 9, + }, { "start": 9, "end": 10 }], + "reservedName": [], + }, { + "name": "FieldOptions", + "field": [{ + "name": "ctype", + "number": 1, + "label": 1, + "type": 14, + "typeName": ".google.protobuf.FieldOptions.CType", + "extendee": "", + "defaultValue": "STRING", + "oneofIndex": 0, + "jsonName": "ctype", + "options": undefined, + "proto3Optional": false, + }, { + "name": "packed", + "number": 2, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "packed", + "options": undefined, + "proto3Optional": false, + }, { + "name": "jstype", + "number": 6, + "label": 1, + "type": 14, + "typeName": ".google.protobuf.FieldOptions.JSType", + "extendee": "", + "defaultValue": "JS_NORMAL", + "oneofIndex": 0, + "jsonName": "jstype", + "options": undefined, + "proto3Optional": false, + }, { + "name": "lazy", + "number": 5, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "lazy", + "options": undefined, + "proto3Optional": false, + }, { + "name": "deprecated", + "number": 3, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "weak", + "number": 10, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "weak", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [{ + "name": "CType", + "value": [{ "name": "STRING", "number": 0, "options": undefined }, { + "name": "CORD", + "number": 1, + "options": undefined, + }, { "name": "STRING_PIECE", "number": 2, "options": undefined }], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "JSType", + "value": [{ "name": "JS_NORMAL", "number": 0, "options": undefined }, { + "name": "JS_STRING", + "number": 1, + "options": undefined, + }, { "name": "JS_NUMBER", "number": 2, "options": undefined }], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [{ "start": 4, "end": 5 }], + "reservedName": [], + }, { + "name": "OneofOptions", + "field": [{ + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "EnumOptions", + "field": [{ + "name": "allow_alias", + "number": 2, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "allowAlias", + "options": undefined, + "proto3Optional": false, + }, { + "name": "deprecated", + "number": 3, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [{ "start": 5, "end": 6 }], + "reservedName": [], + }, { + "name": "EnumValueOptions", + "field": [{ + "name": "deprecated", + "number": 1, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "ServiceOptions", + "field": [{ + "name": "deprecated", + "number": 33, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "MethodOptions", + "field": [{ + "name": "deprecated", + "number": 33, + "label": 1, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "false", + "oneofIndex": 0, + "jsonName": "deprecated", + "options": undefined, + "proto3Optional": false, + }, { + "name": "idempotency_level", + "number": 34, + "label": 1, + "type": 14, + "typeName": ".google.protobuf.MethodOptions.IdempotencyLevel", + "extendee": "", + "defaultValue": "IDEMPOTENCY_UNKNOWN", + "oneofIndex": 0, + "jsonName": "idempotencyLevel", + "options": undefined, + "proto3Optional": false, + }, { + "name": "uninterpreted_option", + "number": 999, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "uninterpretedOption", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [{ + "name": "IdempotencyLevel", + "value": [{ "name": "IDEMPOTENCY_UNKNOWN", "number": 0, "options": undefined }, { + "name": "NO_SIDE_EFFECTS", + "number": 1, + "options": undefined, + }, { "name": "IDEMPOTENT", "number": 2, "options": undefined }], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "extensionRange": [{ "start": 1000, "end": 536870912, "options": undefined }], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "UninterpretedOption", + "field": [{ + "name": "name", + "number": 2, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.UninterpretedOption.NamePart", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "name", + "options": undefined, + "proto3Optional": false, + }, { + "name": "identifier_value", + "number": 3, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "identifierValue", + "options": undefined, + "proto3Optional": false, + }, { + "name": "positive_int_value", + "number": 4, + "label": 1, + "type": 4, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "positiveIntValue", + "options": undefined, + "proto3Optional": false, + }, { + "name": "negative_int_value", + "number": 5, + "label": 1, + "type": 3, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "negativeIntValue", + "options": undefined, + "proto3Optional": false, + }, { + "name": "double_value", + "number": 6, + "label": 1, + "type": 1, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "doubleValue", + "options": undefined, + "proto3Optional": false, + }, { + "name": "string_value", + "number": 7, + "label": 1, + "type": 12, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "stringValue", + "options": undefined, + "proto3Optional": false, + }, { + "name": "aggregate_value", + "number": 8, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "aggregateValue", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [{ + "name": "NamePart", + "field": [{ + "name": "name_part", + "number": 1, + "label": 2, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "namePart", + "options": undefined, + "proto3Optional": false, + }, { + "name": "is_extension", + "number": 2, + "label": 2, + "type": 8, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "isExtension", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "SourceCodeInfo", + "field": [{ + "name": "location", + "number": 1, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.SourceCodeInfo.Location", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "location", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [{ + "name": "Location", + "field": [{ + "name": "path", + "number": 1, + "label": 3, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "path", + "options": { + "ctype": 0, + "packed": true, + "jstype": 0, + "lazy": false, + "deprecated": false, + "weak": false, + "uninterpretedOption": [], + }, + "proto3Optional": false, + }, { + "name": "span", + "number": 2, + "label": 3, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "span", + "options": { + "ctype": 0, + "packed": true, + "jstype": 0, + "lazy": false, + "deprecated": false, + "weak": false, + "uninterpretedOption": [], + }, + "proto3Optional": false, + }, { + "name": "leading_comments", + "number": 3, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "leadingComments", + "options": undefined, + "proto3Optional": false, + }, { + "name": "trailing_comments", + "number": 4, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "trailingComments", + "options": undefined, + "proto3Optional": false, + }, { + "name": "leading_detached_comments", + "number": 6, + "label": 3, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "leadingDetachedComments", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "GeneratedCodeInfo", + "field": [{ + "name": "annotation", + "number": 1, + "label": 3, + "type": 11, + "typeName": ".google.protobuf.GeneratedCodeInfo.Annotation", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "annotation", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [{ + "name": "Annotation", + "field": [{ + "name": "path", + "number": 1, + "label": 3, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "path", + "options": { + "ctype": 0, + "packed": true, + "jstype": 0, + "lazy": false, + "deprecated": false, + "weak": false, + "uninterpretedOption": [], + }, + "proto3Optional": false, + }, { + "name": "source_file", + "number": 2, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "sourceFile", + "options": undefined, + "proto3Optional": false, + }, { + "name": "begin", + "number": 3, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "begin", + "options": undefined, + "proto3Optional": false, + }, { + "name": "end", + "number": 4, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "end", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "service": [], + "extension": [], + "options": { + "javaPackage": "com.google.protobuf", + "javaOuterClassname": "DescriptorProtos", + "javaMultipleFiles": false, + "javaGenerateEqualsAndHash": false, + "javaStringCheckUtf8": false, + "optimizeFor": 1, + "goPackage": "google.golang.org/protobuf/types/descriptorpb", + "ccGenericServices": false, + "javaGenericServices": false, + "pyGenericServices": false, + "phpGenericServices": false, + "deprecated": false, + "ccEnableArenas": true, + "objcClassPrefix": "GPB", + "csharpNamespace": "Google.Protobuf.Reflection", + "swiftPrefix": "", + "phpClassPrefix": "", + "phpNamespace": "", + "phpMetadataNamespace": "", + "rubyPackage": "", + "uninterpretedOption": [], + }, + "sourceCodeInfo": { + "location": [{ + "path": [8, 9], + "span": [52, 0, 28], + "leadingComments": + " descriptor.proto must be optimized for speed because reflection-based\n algorithms don't work during bootstrapping.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 0], + "span": [56, 0, 58, 1], + "leadingComments": + " The protocol compiler can output a FileDescriptorSet containing the .proto\n files it parses.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1], + "span": [61, 0, 90, 1], + "leadingComments": " Describes a complete .proto file.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 0], + "span": [62, 2, 27], + "leadingComments": "", + "trailingComments": " file name, relative to root of source tree\n", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 1], + "span": [63, 2, 30], + "leadingComments": "", + "trailingComments": ' e.g. "foo", "foo.bar", etc.\n', + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 2], + "span": [66, 2, 33], + "leadingComments": " Names of files imported by this file.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 3], + "span": [68, 2, 40], + "leadingComments": " Indexes of the public imported files in the dependency list above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 4], + "span": [71, 2, 38], + "leadingComments": + " Indexes of the weak imported files in the dependency list.\n For Google-internal migration only. Do not use.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 5], + "span": [74, 2, 44], + "leadingComments": " All top-level definitions in this file.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 10], + "span": [85, 2, 47], + "leadingComments": + " This field contains optional information about the original source code.\n You may safely remove this entire field without harming runtime\n functionality of the descriptors -- the information is needed only by\n development tools.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 1, 2, 11], + "span": [89, 2, 30], + "leadingComments": ' The syntax of the proto file.\n The supported values are "proto2" and "proto3".\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 2], + "span": [93, 0, 125, 1], + "leadingComments": " Describes a message type.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 2, 3, 0, 2, 0], + "span": [103, 4, 29], + "leadingComments": "", + "trailingComments": " Inclusive.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 2, 3, 0, 2, 1], + "span": [104, 4, 27], + "leadingComments": "", + "trailingComments": " Exclusive.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 2, 3, 1], + "span": [117, 2, 120, 3], + "leadingComments": + " Range of reserved tag numbers. Reserved tag numbers may not be used by\n fields or extension ranges in the same message. Reserved ranges may\n not overlap.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 2, 3, 1, 2, 0], + "span": [118, 4, 29], + "leadingComments": "", + "trailingComments": " Inclusive.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 2, 3, 1, 2, 1], + "span": [119, 4, 27], + "leadingComments": "", + "trailingComments": " Exclusive.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 2, 2, 9], + "span": [124, 2, 37], + "leadingComments": + " Reserved field names, which may not be used by fields in the same message.\n A given name may only be reserved once.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 3, 2, 0], + "span": [129, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 3, 5], + "span": [133, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4], + "span": [137, 0, 238, 1], + "leadingComments": " Describes a field within a message.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 0], + "span": [141, 4, 20], + "leadingComments": " 0 is reserved for errors.\n Order is weird for historical reasons.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 2], + "span": [145, 4, 19], + "leadingComments": + " Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if\n negative values are likely.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 4], + "span": [149, 4, 19], + "leadingComments": + " Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if\n negative values are likely.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 9], + "span": [158, 4, 20], + "leadingComments": + " Tag-delimited aggregate.\n Group type is deprecated and not supported in proto3. However, Proto3\n implementations should still be able to parse the group wire format and\n treat group fields as unknown fields.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 10], + "span": [159, 4, 22], + "leadingComments": "", + "trailingComments": " Length-delimited aggregate.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 11], + "span": [162, 4, 20], + "leadingComments": " New in version 2.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 16], + "span": [167, 4, 21], + "leadingComments": "", + "trailingComments": " Uses ZigZag encoding.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 0, 2, 17], + "span": [168, 4, 21], + "leadingComments": "", + "trailingComments": " Uses ZigZag encoding.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 4, 1, 2, 0], + "span": [173, 4, 23], + "leadingComments": " 0 is reserved for errors\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 3], + "span": [184, 2, 25], + "leadingComments": + " If type_name is set, this need not be set. If both this and type_name\n are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 4], + "span": [191, 2, 32], + "leadingComments": + " For message and enum types, this is the name of the type. If the name\n starts with a '.', it is fully-qualified. Otherwise, C++-like scoping\n rules are used to find the type (i.e. first the nested types within this\n message are searched, then within the parent, on up to the root\n namespace).\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 5], + "span": [195, 2, 31], + "leadingComments": + " For extensions, this is the name of the type being extended. It is\n resolved in the same manner as type_name.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 6], + "span": [202, 2, 36], + "leadingComments": + ' For numeric types, contains the original text representation of the value.\n For booleans, "true" or "false".\n For strings, contains the default text contents (not escaped in any way).\n For bytes, contains the C escaped value. All bytes >= 128 are escaped.\n TODO(kenton): Base-64 encode?\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 7], + "span": [206, 2, 33], + "leadingComments": + " If set, gives the index of a oneof in the containing type's oneof_decl\n list. This field is a member of that oneof.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 8], + "span": [212, 2, 33], + "leadingComments": + " JSON name of this field. The value is set by protocol compiler. If the\n user has set a \"json_name\" option on this field, that option's value\n will be used. Otherwise, it's deduced from the field's name by converting\n it to camelCase.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 4, 2, 10], + "span": [237, 2, 37], + "leadingComments": + ' If true, this is a proto3 "optional". When a proto3 field is optional, it\n tracks presence regardless of field type.\n\n When proto3_optional is true, this field must be belong to a oneof to\n signal to old proto3 clients that presence is tracked for this field. This\n oneof is known as a "synthetic" oneof, and this field must be its sole\n member (each proto3 optional field gets its own synthetic oneof). Synthetic\n oneofs exist in the descriptor only, and do not generate any API. Synthetic\n oneofs must be ordered after all "real" oneofs.\n\n For message fields, proto3_optional doesn\'t create any semantic change,\n since non-repeated message fields always track presence. However it still\n indicates the semantic detail of whether the user wrote "optional" or not.\n This can be useful for round-tripping the .proto file. For consistency we\n give message fields a synthetic oneof also, even though it is not required\n to track presence. This is especially important because the parser can\'t\n tell if a field is a message or an enum, so it must always create a\n synthetic oneof.\n\n Proto2 optional fields do not set this flag, because they already indicate\n optional with `LABEL_OPTIONAL`.\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 5], + "span": [241, 0, 244, 1], + "leadingComments": " Describes a oneof.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 6], + "span": [247, 0, 273, 1], + "leadingComments": " Describes an enum type.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 6, 3, 0], + "span": [260, 2, 263, 3], + "leadingComments": + " Range of reserved numeric values. Reserved values may not be used by\n entries in the same enum. Reserved ranges may not overlap.\n\n Note that this is distinct from DescriptorProto.ReservedRange in that it\n is inclusive such that it can appropriately represent the entire int32\n domain.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 6, 3, 0, 2, 0], + "span": [261, 4, 29], + "leadingComments": "", + "trailingComments": " Inclusive.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 6, 3, 0, 2, 1], + "span": [262, 4, 27], + "leadingComments": "", + "trailingComments": " Inclusive.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 6, 2, 3], + "span": [268, 2, 48], + "leadingComments": + " Range of reserved numeric values. Reserved numeric values may not be used\n by enum values in the same enum declaration. Reserved ranges may not\n overlap.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 6, 2, 4], + "span": [272, 2, 36], + "leadingComments": + " Reserved enum value names, which may not be reused. A given name may only\n be reserved once.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 7], + "span": [276, 0, 281, 1], + "leadingComments": " Describes a value within an enum.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 8], + "span": [284, 0, 289, 1], + "leadingComments": " Describes a service.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 9], + "span": [292, 0, 306, 1], + "leadingComments": " Describes a method of a service.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 9, 2, 1], + "span": [297, 2, 33], + "leadingComments": + " Input and output type names. These are resolved in the same way as\n FieldDescriptorProto.type_name, but must refer to a message type.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 9, 2, 4], + "span": [303, 2, 55], + "leadingComments": " Identifies if client streams multiple client messages\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 9, 2, 5], + "span": [305, 2, 55], + "leadingComments": " Identifies if server streams multiple server messages\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 0], + "span": [347, 2, 35], + "leadingComments": + " Sets the Java package where classes generated from this .proto will be\n placed. By default, the proto package is used, but this is often\n inappropriate because proto packages do not normally start with backwards\n domain names.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 1], + "span": [355, 2, 43], + "leadingComments": + " Controls the name of the wrapper Java class generated for the .proto file.\n That class will always contain the .proto file's getDescriptor() method as\n well as any top-level extensions defined in the .proto file.\n If java_multiple_files is disabled, then all the other classes from the\n .proto file will be nested inside the single wrapper outer class.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 2], + "span": [363, 2, 59], + "leadingComments": + " If enabled, then the Java code generator will generate a separate .java\n file for each top-level message, enum, and service defined in the .proto\n file. Thus, these types will *not* be nested inside the wrapper class\n named by java_outer_classname. However, the wrapper class will still be\n generated to contain the file's getDescriptor() method as well as any\n top-level extensions defined in the file.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 3], + "span": [366, 2, 69], + "leadingComments": " This option does nothing.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 4], + "span": [374, 2, 62], + "leadingComments": + " If set true, then the Java2 code generator will generate code that\n throws an exception whenever an attempt is made to assign a non-UTF-8\n byte sequence to a string field.\n Message reflection will do the same.\n However, an extension field still accepts non-UTF-8 byte sequences.\n This option has no effect on when used with the lite runtime.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 4, 0], + "span": [378, 2, 383, 3], + "leadingComments": " Generated classes can be optimized for speed or code size.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 4, 0, 2, 0], + "span": [379, 4, 14], + "leadingComments": "", + "trailingComments": " Generate complete code for parsing, serialization,\n", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 4, 0, 2, 1], + "span": [381, 4, 18], + "leadingComments": " etc.\n", + "trailingComments": " Use ReflectionOps to implement these methods.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 4, 0, 2, 2], + "span": [382, 4, 21], + "leadingComments": "", + "trailingComments": " Generate code using MessageLite and the lite runtime.\n", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 6], + "span": [391, 2, 34], + "leadingComments": + " Sets the Go package where structs generated from this .proto will be\n placed. If omitted, the Go package will be derived from the following:\n - The basename of the package import path, if provided.\n - Otherwise, the package statement in the .proto file, if present.\n - Otherwise, the basename of the .proto file, without extension.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 7], + "span": [406, 2, 59], + "leadingComments": + ' Should generic services be generated in each language? "Generic" services\n are not specific to any particular RPC system. They are generated by the\n main code generators in each language (without additional plugins).\n Generic services were the only kind of service generation supported by\n early versions of google.protobuf.\n\n Generic services are now considered deprecated in favor of using plugins\n that generate code specific to your particular RPC system. Therefore,\n these default to false. Old code which depends on generic services should\n explicitly set them to true.\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 11], + "span": [415, 2, 50], + "leadingComments": + " Is this file deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for everything in the file, or it will be completely ignored; in the very\n least, this is a formalization for deprecating files.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 12], + "span": [419, 2, 55], + "leadingComments": + " Enables the use of arenas for the proto messages in this file. This applies\n only to generated classes for C++.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 13], + "span": [424, 2, 41], + "leadingComments": + " Sets the objective c class prefix which is prepended to all objective c\n generated classes from this .proto. There is no default.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 14], + "span": [427, 2, 40], + "leadingComments": " Namespace for generated classes; defaults to the package.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 15], + "span": [433, 2, 36], + "leadingComments": + " By default Swift generators will take the proto package and CamelCase it\n replacing '.' with underscore and use that to prefix the types/symbols\n defined. When this options is provided, they will use this value instead\n to prefix the types/symbols defined.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 16], + "span": [437, 2, 40], + "leadingComments": + " Sets the php class prefix which is prepended to all php generated classes\n from this .proto. Default is empty.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 17], + "span": [442, 2, 37], + "leadingComments": + " Use this option to change the namespace of php generated classes. Default\n is empty. When this option is empty, the package name will be used for\n determining the namespace.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 18], + "span": [447, 2, 46], + "leadingComments": + " Use this option to change the namespace of php generated metadata classes.\n Default is empty. When this option is empty, the proto file name will be\n used for determining the namespace.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 19], + "span": [452, 2, 36], + "leadingComments": + " Use this option to change the package of ruby generated classes. Default\n is empty. When this option is not set, the package name will be used for\n determining the ruby package.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 2, 20], + "span": [457, 2, 58], + "leadingComments": + ' The parser stores options it doesn\'t recognize here.\n See the documentation for the "Options" section above.\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 10, 5], + "span": [461, 2, 25], + "leadingComments": + ' Clients can define custom options in extensions of this message.\n See the documentation for the "Options" section above.\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 2, 0], + "span": [485, 2, 62], + "leadingComments": + " Set true to use the old proto1 MessageSet wire format for extensions.\n This is provided for backwards-compatibility with the MessageSet wire\n format. You should not use this for any other reason: It's less\n efficient, has fewer features, and is more complicated.\n\n The message must be defined exactly as follows:\n message Foo {\n option message_set_wire_format = true;\n extensions 4 to max;\n }\n Note that the message cannot have any defined fields; MessageSets only\n have extensions.\n\n All extensions of your type must be singular messages; e.g. they cannot\n be int32s, enums, or repeated messages.\n\n Because this is an option, the above two restrictions are not enforced by\n the protocol compiler.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 2, 1], + "span": [490, 2, 70], + "leadingComments": + ' Disables the generation of the standard "descriptor()" accessor, which can\n conflict with a field of the same name. This is meant to make migration\n from proto1 easier; new code should avoid fields named "descriptor".\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 2, 2], + "span": [496, 2, 49], + "leadingComments": + " Is this message deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for the message, or it will be completely ignored; in the very least,\n this is a formalization for deprecating messages.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 2, 3], + "span": [521, 2, 30], + "leadingComments": + " Whether the message is an automatically generated map entry type for the\n maps field.\n\n For maps fields:\n map map_field = 1;\n The parsed descriptor looks like:\n message MapFieldEntry {\n option map_entry = true;\n optional KeyType key = 1;\n optional ValueType value = 2;\n }\n repeated MapFieldEntry map_field = 1;\n\n Implementations may choose not to generate the map_entry=true message, but\n use a native map in the target language to hold the keys and values.\n The reflection APIs in such implementations still need to work as\n if the field is a repeated message field.\n\n NOTE: Do not set the option in .proto files. Always use the maps syntax\n instead. The option should only be implicitly set by the proto compiler\n parser.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 9], + "span": [523, 2, 13], + "leadingComments": "", + "trailingComments": " javalite_serializable\n", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 9], + "span": [524, 2, 13], + "leadingComments": "", + "trailingComments": " javanano_as_lite\n", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 2, 4], + "span": [528, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 11, 5], + "span": [531, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 0], + "span": [539, 2, 46], + "leadingComments": + " The ctype option instructs the C++ code generator to use a different\n representation of the field than it normally would. See the specific\n options below. This option is not yet implemented in the open source\n release -- sorry, we'll try to include it in a future version!\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 4, 0, 2, 0], + "span": [542, 4, 15], + "leadingComments": " Default mode.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 1], + "span": [553, 2, 27], + "leadingComments": + " The packed option can be enabled for repeated primitive fields to enable\n a more efficient representation on the wire. Rather than repeatedly\n writing the tag and type for each element, the entire array is encoded as\n a single length-delimited blob. In proto3, only explicit setting it to\n false will avoid using packed encoding.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 2], + "span": [566, 2, 51], + "leadingComments": + ' The jstype option determines the JavaScript type used for values of the\n field. The option is permitted only for 64 bit integral and fixed types\n (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING\n is represented as JavaScript string, which avoids loss of precision that\n can happen when a large value is converted to a floating point JavaScript.\n Specifying JS_NUMBER for the jstype causes the generated JavaScript code to\n use the JavaScript "number" type. The behavior of the default option\n JS_NORMAL is implementation dependent.\n\n This option is an enum to permit additional types to be added, e.g.\n goog.math.Integer.\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 4, 1, 2, 0], + "span": [569, 4, 18], + "leadingComments": " Use the default type.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 4, 1, 2, 1], + "span": [572, 4, 18], + "leadingComments": " Use JavaScript strings.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 4, 1, 2, 2], + "span": [575, 4, 18], + "leadingComments": " Use JavaScript numbers.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 3], + "span": [606, 2, 43], + "leadingComments": + " Should this field be parsed lazily? Lazy applies only to message-type\n fields. It means that when the outer message is initially parsed, the\n inner message's contents will not be parsed but instead stored in encoded\n form. The inner message will actually be parsed when it is first accessed.\n\n This is only a hint. Implementations are free to choose whether to use\n eager or lazy parsing regardless of the value of this option. However,\n setting this option true suggests that the protocol author believes that\n using lazy parsing on this field is worth the additional bookkeeping\n overhead typically needed to implement it.\n\n This option does not affect the public interface of any generated code;\n all method signatures remain the same. Furthermore, thread-safety of the\n interface is not affected by this option; const methods remain safe to\n call from multiple threads concurrently, while non-const methods continue\n to require exclusive access.\n\n\n Note that implementations may choose not to check required fields within\n a lazy sub-message. That is, calling IsInitialized() on the outer message\n may return true even if the inner message has missing required fields.\n This is necessary because otherwise the inner message would have to be\n parsed in order to perform the check, defeating the purpose of lazy\n parsing. An implementation which chooses not to check required fields\n must be consistent about it. That is, for any particular sub-message, the\n implementation must either *always* check its required fields, or *never*\n check its required fields, regardless of whether or not the message has\n been parsed.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 4], + "span": [612, 2, 49], + "leadingComments": + " Is this field deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for accessors, or it will be completely ignored; in the very least, this\n is a formalization for deprecating fields.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 5], + "span": [615, 2, 44], + "leadingComments": " For Google-internal migration only. Do not use.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 2, 6], + "span": [619, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 5], + "span": [622, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 12, 9], + "span": [624, 2, 13], + "leadingComments": "", + "trailingComments": " removed jtype\n", + "leadingDetachedComments": [], + }, { + "path": [4, 13, 2, 0], + "span": [629, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 13, 5], + "span": [632, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 14, 2, 0], + "span": [639, 2, 32], + "leadingComments": " Set this option to true to allow mapping different tag names to the same\n value.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 14, 2, 1], + "span": [645, 2, 49], + "leadingComments": + " Is this enum deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for the enum, or it will be completely ignored; in the very least, this\n is a formalization for deprecating enums.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 14, 9], + "span": [647, 2, 13], + "leadingComments": "", + "trailingComments": " javanano_as_lite\n", + "leadingDetachedComments": [], + }, { + "path": [4, 14, 2, 2], + "span": [650, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 14, 5], + "span": [653, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 15, 2, 0], + "span": [661, 2, 49], + "leadingComments": + " Is this enum value deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for the enum value, or it will be completely ignored; in the very least,\n this is a formalization for deprecating enum values.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 15, 2, 1], + "span": [664, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 15, 5], + "span": [667, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 16, 2, 0], + "span": [681, 2, 50], + "leadingComments": + " Is this service deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for the service, or it will be completely ignored; in the very least,\n this is a formalization for deprecating services.\n", + "trailingComments": "", + "leadingDetachedComments": [ + " Note: Field numbers 1 through 32 are reserved for Google's internal RPC\n framework. We apologize for hoarding these numbers to ourselves, but\n we were already using them long before we decided to release Protocol\n Buffers.\n", + ], + }, { + "path": [4, 16, 2, 1], + "span": [684, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 16, 5], + "span": [687, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 17, 2, 0], + "span": [701, 2, 50], + "leadingComments": + " Is this method deprecated?\n Depending on the target platform, this can emit Deprecated annotations\n for the method, or it will be completely ignored; in the very least,\n this is a formalization for deprecating methods.\n", + "trailingComments": "", + "leadingDetachedComments": [ + " Note: Field numbers 1 through 32 are reserved for Google's internal RPC\n framework. We apologize for hoarding these numbers to ourselves, but\n we were already using them long before we decided to release Protocol\n Buffers.\n", + ], + }, { + "path": [4, 17, 4, 0], + "span": [706, 2, 710, 3], + "leadingComments": + " Is this method side-effect-free (or safe in HTTP parlance), or idempotent,\n or neither? HTTP based RPC implementation may choose GET verb for safe\n methods, and PUT verb for idempotent methods instead of the default POST.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 17, 4, 0, 2, 1], + "span": [708, 4, 24], + "leadingComments": "", + "trailingComments": " implies idempotent\n", + "leadingDetachedComments": [], + }, { + "path": [4, 17, 4, 0, 2, 2], + "span": [709, 4, 19], + "leadingComments": "", + "trailingComments": " idempotent, but may have side effects\n", + "leadingDetachedComments": [], + }, { + "path": [4, 17, 2, 2], + "span": [715, 2, 58], + "leadingComments": " The parser stores options it doesn't recognize here. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 17, 5], + "span": [718, 2, 25], + "leadingComments": " Clients can define custom options in extensions of this message. See above.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 18], + "span": [728, 0, 748, 1], + "leadingComments": + " A message representing a option the parser does not recognize. This only\n appears in options protos created by the compiler::Parser class.\n DescriptorPool resolves these when building Descriptor objects. Therefore,\n options protos in descriptor objects (e.g. returned by Descriptor::options(),\n or produced by Descriptor::CopyTo()) will never have UninterpretedOptions\n in them.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 18, 3, 0], + "span": [734, 2, 737, 3], + "leadingComments": + ' The name of the uninterpreted option. Each string represents a segment in\n a dot-separated name. is_extension is true iff a segment represents an\n extension (denoted with parentheses in options specs in .proto files).\n E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents\n "foo.(bar.baz).qux".\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 18, 2, 1], + "span": [742, 2, 39], + "leadingComments": + " The value of the uninterpreted option, in whatever type the tokenizer\n identified it as during parsing. Exactly one of these should be set.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 19], + "span": [755, 0, 884, 1], + "leadingComments": + " Encapsulates information about the original source file from which a\n FileDescriptorProto was generated.\n", + "trailingComments": "", + "leadingDetachedComments": [ + " ===================================================================\n Optional source code info\n", + ], + }, { + "path": [4, 19, 2, 0], + "span": [799, 2, 33], + "leadingComments": + ' A Location identifies a piece of source code in a .proto file which\n corresponds to a particular definition. This information is intended\n to be useful to IDEs, code indexers, documentation generators, and similar\n tools.\n\n For example, say we have a file like:\n message Foo {\n optional string foo = 1;\n }\n Let\'s look at just the field definition:\n optional string foo = 1;\n ^ ^^ ^^ ^ ^^^\n a bc de f ghi\n We have the following locations:\n span path represents\n [a,i) [ 4, 0, 2, 0 ] The whole field definition.\n [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).\n [c,d) [ 4, 0, 2, 0, 5 ] The type (string).\n [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).\n [g,h) [ 4, 0, 2, 0, 3 ] The number (1).\n\n Notes:\n - A location may refer to a repeated field itself (i.e. not to any\n particular index within it). This is used whenever a set of elements are\n logically enclosed in a single code segment. For example, an entire\n extend block (possibly containing multiple extension definitions) will\n have an outer location whose path refers to the "extensions" repeated\n field without an index.\n - Multiple locations may have the same path. This happens when a single\n logical declaration is spread out across multiple places. The most\n obvious example is the "extend" block again -- there may be multiple\n extend blocks in the same scope, each of which will have the same path.\n - A location\'s span is not always a subset of its parent\'s span. For\n example, the "extendee" of an extension declaration appears at the\n beginning of the "extend" block and is shared by all extensions within\n the block.\n - Just because a location\'s span is a subset of some other location\'s span\n does not mean that it is a descendant. For example, a "group" defines\n both a type and a field in a single declaration. Thus, the locations\n corresponding to the type and field and their components will overlap.\n - Code which tries to interpret locations should probably be designed to\n ignore those that it doesn\'t understand, as more types of locations could\n be recorded in the future.\n', + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 19, 3, 0, 2, 0], + "span": [824, 4, 44], + "leadingComments": + " Identifies which part of the FileDescriptorProto was defined at this\n location.\n\n Each element is a field number or an index. They form a path from\n the root FileDescriptorProto to the place where the definition. For\n example, this path:\n [ 4, 3, 2, 7, 1 ]\n refers to:\n file.message_type(3) // 4, 3\n .field(7) // 2, 7\n .name() // 1\n This is because FileDescriptorProto.message_type has field number 4:\n repeated DescriptorProto message_type = 4;\n and DescriptorProto.field has field number 2:\n repeated FieldDescriptorProto field = 2;\n and FieldDescriptorProto.name has field number 1:\n optional string name = 1;\n\n Thus, the above path gives the location of a field name. If we removed\n the last element:\n [ 4, 3, 2, 7 ]\n this path refers to the whole field declaration (from the beginning\n of the label to the terminating semicolon).\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 19, 3, 0, 2, 1], + "span": [831, 4, 44], + "leadingComments": + " Always has exactly three or four elements: start line, start column,\n end line (optional, otherwise assumed same as start line), end column.\n These are packed into a single field for efficiency. Note that line\n and column numbers are zero-based -- typically you will want to add\n 1 to each before displaying to a user.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 19, 3, 0, 2, 2], + "span": [880, 4, 41], + "leadingComments": + " If this SourceCodeInfo represents a complete declaration, these are any\n comments appearing before and after the declaration which appear to be\n attached to the declaration.\n\n A series of line comments appearing on consecutive lines, with no other\n tokens appearing on those lines, will be treated as a single comment.\n\n leading_detached_comments will keep paragraphs of comments that appear\n before (but not connected to) the current element. Each paragraph,\n separated by empty lines, will be one comment element in the repeated\n field.\n\n Only the comment content is provided; comment markers (e.g. //) are\n stripped out. For block comments, leading whitespace and an asterisk\n will be stripped from the beginning of each line other than the first.\n Newlines are included in the output.\n\n Examples:\n\n optional int32 foo = 1; // Comment attached to foo.\n // Comment attached to bar.\n optional int32 bar = 2;\n\n optional string baz = 3;\n // Comment attached to baz.\n // Another line attached to baz.\n\n // Comment attached to qux.\n //\n // Another line attached to qux.\n optional double qux = 4;\n\n // Detached comment for corge. This is not leading or trailing comments\n // to qux or corge because there are blank lines separating it from\n // both.\n\n // Detached comment for corge paragraph 2.\n\n optional string corge = 5;\n /* Block comment attached\n * to corge. Leading asterisks\n * will be removed. */\n /* Block comment attached to\n * grault. */\n optional int32 grault = 6;\n\n // ignored detached comments.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 20], + "span": [889, 0, 910, 1], + "leadingComments": + " Describes the relationship between generated code and its original source\n file. A GeneratedCodeInfo message is associated with only one generated\n source file, but may contain references to different source .proto files.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 20, 2, 0], + "span": [892, 2, 37], + "leadingComments": + " An Annotation connects some span of text in generated code to an element\n of its generating .proto file.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 20, 3, 0, 2, 0], + "span": [896, 4, 44], + "leadingComments": + " Identifies the element in the original source .proto file. This field\n is formatted the same as SourceCodeInfo.Location.path.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 20, 3, 0, 2, 1], + "span": [899, 4, 36], + "leadingComments": " Identifies the filesystem path to the original source .proto.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 20, 3, 0, 2, 2], + "span": [903, 4, 29], + "leadingComments": + " Identifies the starting offset in bytes in the generated code\n that relates to the identified object.\n", + "trailingComments": "", + "leadingDetachedComments": [], + }, { + "path": [4, 20, 3, 0, 2, 3], + "span": [908, 4, 27], + "leadingComments": + " Identifies the ending offset in bytes in the generated code that\n relates to the identified offset. The end offset should be one past\n the last relevant byte (so the length of the text = end - begin).\n", + "trailingComments": "", + "leadingDetachedComments": [], + }], + }, + "syntax": "", + }), + references: { + ".google.protobuf.FieldDescriptorProto.Type": FieldDescriptorProto_Type, + ".google.protobuf.FieldDescriptorProto.Label": FieldDescriptorProto_Label, + ".google.protobuf.FileOptions.OptimizeMode": FileOptions_OptimizeMode, + ".google.protobuf.FieldOptions.CType": FieldOptions_CType, + ".google.protobuf.FieldOptions.JSType": FieldOptions_JSType, + ".google.protobuf.MethodOptions.IdempotencyLevel": MethodOptions_IdempotencyLevel, + }, + dependencies: [], +}; diff --git a/integration/options-types-only/options-test.ts b/integration/options-types-only/options-test.ts new file mode 100644 index 000000000..485174ecc --- /dev/null +++ b/integration/options-types-only/options-test.ts @@ -0,0 +1,11 @@ +import { protoMetadata } from "./options"; + +describe("options", () => { + it("compiles", () => { + expect(protoMetadata).not.toBeUndefined(); + }); + + it("has the right options", () => { + expect(protoMetadata.options?.messages?.["MyMessage"]?.options?.["my_message_option"]).toBe(1234); + }); +}); diff --git a/integration/options-types-only/options.bin b/integration/options-types-only/options.bin new file mode 100644 index 000000000..a96b5e3cb Binary files /dev/null and b/integration/options-types-only/options.bin differ diff --git a/integration/options-types-only/options.proto b/integration/options-types-only/options.proto new file mode 100644 index 000000000..8f4cf219f --- /dev/null +++ b/integration/options-types-only/options.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; +import "something/something.proto"; + +extend google.protobuf.FileOptions { + optional string my_file_option = 50000; +} + +extend google.protobuf.MessageOptions { + optional int32 my_message_option = 50001; +} + +extend google.protobuf.FieldOptions { + optional float my_field_option = 50002; +} + +extend google.protobuf.OneofOptions { + optional int64 my_oneof_option = 50003; +} + +extend google.protobuf.EnumOptions { + optional bool my_enum_option = 50004; +} + +extend google.protobuf.EnumValueOptions { + optional uint32 my_enum_value_option = 50005; +} + +extend google.protobuf.ServiceOptions { + optional MyEnum my_service_option = 50006; +} + +extend google.protobuf.MethodOptions { + optional MyMessage my_method_option = 50007; +} + +option (my_file_option) = "Hello world!"; + +message MyMessage { + option (my_message_option) = 1234; + + optional int32 foo = 1 [(my_field_option) = 4.5]; + optional int32 foo_2 = 2 [(something.something) = { + hello: "world"; + foo: [123, 345]; + }]; + optional string bar = 3; + oneof qux { + option (my_oneof_option) = 42; + + string quux = 4; + } +} + +enum MyEnum { + option (my_enum_option) = true; + + FOO = 0 [(my_enum_value_option) = 321]; + BAR = 1; +} + +message RequestType {} +message ResponseType {} + +service MyService { + option (my_service_option) = FOO; + + rpc MyMethod(RequestType) returns(ResponseType) { + option (my_method_option).foo = 150; + option (my_method_option).foo_2 = 150; + option (my_method_option).bar = "Some string"; + option (my_method_option).quux = "Some string"; + } +} diff --git a/integration/options-types-only/options.ts b/integration/options-types-only/options.ts new file mode 100644 index 000000000..81ab5b340 --- /dev/null +++ b/integration/options-types-only/options.ts @@ -0,0 +1,331 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// source: options.proto + +/* eslint-disable */ +import { FileDescriptorProto as FileDescriptorProto1 } from "ts-proto-descriptors"; +import { protoMetadata as protoMetadata1 } from "./google/protobuf/descriptor"; +import { protoMetadata as protoMetadata2 } from "./something/something"; + +export const protobufPackage = ""; + +export enum MyEnum { + FOO = 0, + BAR = 1, + UNRECOGNIZED = -1, +} + +export interface MyMessage { + foo?: number | undefined; + foo2?: number | undefined; + bar?: string | undefined; + quux?: string | undefined; +} + +export interface RequestType { +} + +export interface ResponseType { +} + +export interface MyService { + MyMethod(request: RequestType): Promise; +} + +type ProtoMetaMessageOptions = { + options?: { [key: string]: any }; + fields?: { [key: string]: { [key: string]: any } }; + oneof?: { [key: string]: { [key: string]: any } }; + nested?: { [key: string]: ProtoMetaMessageOptions }; +}; + +export interface ProtoMetadata { + fileDescriptor: FileDescriptorProto1; + references: { [key: string]: any }; + dependencies?: ProtoMetadata[]; + options?: { + options?: { [key: string]: any }; + services?: { + [key: string]: { options?: { [key: string]: any }; methods?: { [key: string]: { [key: string]: any } } }; + }; + messages?: { [key: string]: ProtoMetaMessageOptions }; + enums?: { [key: string]: { options?: { [key: string]: any }; values?: { [key: string]: { [key: string]: any } } } }; + }; +} + +export const protoMetadata: ProtoMetadata = { + fileDescriptor: FileDescriptorProto1.fromPartial({ + "name": "options.proto", + "package": "", + "dependency": ["google/protobuf/descriptor.proto", "something/something.proto"], + "publicDependency": [], + "weakDependency": [], + "messageType": [{ + "name": "MyMessage", + "field": [{ + "name": "foo", + "number": 1, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 1, + "jsonName": "foo", + "options": { + "ctype": 0, + "packed": false, + "jstype": 0, + "lazy": false, + "deprecated": false, + "weak": false, + "uninterpretedOption": [], + }, + "proto3Optional": true, + }, { + "name": "foo_2", + "number": 2, + "label": 1, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 2, + "jsonName": "foo2", + "options": { + "ctype": 0, + "packed": false, + "jstype": 0, + "lazy": false, + "deprecated": false, + "weak": false, + "uninterpretedOption": [], + }, + "proto3Optional": true, + }, { + "name": "bar", + "number": 3, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 3, + "jsonName": "bar", + "options": undefined, + "proto3Optional": true, + }, { + "name": "quux", + "number": 4, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "quux", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [ + { "name": "qux", "options": { "uninterpretedOption": [] } }, + { "name": "_foo", "options": undefined }, + { "name": "_foo_2", "options": undefined }, + { "name": "_bar", "options": undefined }, + ], + "options": { + "messageSetWireFormat": false, + "noStandardDescriptorAccessor": false, + "deprecated": false, + "mapEntry": false, + "uninterpretedOption": [], + }, + "reservedRange": [], + "reservedName": [], + }, { + "name": "RequestType", + "field": [], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }, { + "name": "ResponseType", + "field": [], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [{ + "name": "MyEnum", + "value": [{ "name": "FOO", "number": 0, "options": { "deprecated": false, "uninterpretedOption": [] } }, { + "name": "BAR", + "number": 1, + "options": undefined, + }], + "options": { "allowAlias": false, "deprecated": false, "uninterpretedOption": [] }, + "reservedRange": [], + "reservedName": [], + }], + "service": [{ + "name": "MyService", + "method": [{ + "name": "MyMethod", + "inputType": ".RequestType", + "outputType": ".ResponseType", + "options": { "deprecated": false, "idempotencyLevel": 0, "uninterpretedOption": [] }, + "clientStreaming": false, + "serverStreaming": false, + }], + "options": { "deprecated": false, "uninterpretedOption": [] }, + }], + "extension": [{ + "name": "my_file_option", + "number": 50000, + "label": 1, + "type": 9, + "typeName": "", + "extendee": ".google.protobuf.FileOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myFileOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_message_option", + "number": 50001, + "label": 1, + "type": 5, + "typeName": "", + "extendee": ".google.protobuf.MessageOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myMessageOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_field_option", + "number": 50002, + "label": 1, + "type": 2, + "typeName": "", + "extendee": ".google.protobuf.FieldOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myFieldOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_oneof_option", + "number": 50003, + "label": 1, + "type": 3, + "typeName": "", + "extendee": ".google.protobuf.OneofOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myOneofOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_enum_option", + "number": 50004, + "label": 1, + "type": 8, + "typeName": "", + "extendee": ".google.protobuf.EnumOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myEnumOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_enum_value_option", + "number": 50005, + "label": 1, + "type": 13, + "typeName": "", + "extendee": ".google.protobuf.EnumValueOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myEnumValueOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_service_option", + "number": 50006, + "label": 1, + "type": 14, + "typeName": ".MyEnum", + "extendee": ".google.protobuf.ServiceOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myServiceOption", + "options": undefined, + "proto3Optional": true, + }, { + "name": "my_method_option", + "number": 50007, + "label": 1, + "type": 11, + "typeName": ".MyMessage", + "extendee": ".google.protobuf.MethodOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "myMethodOption", + "options": undefined, + "proto3Optional": true, + }], + "options": { + "javaPackage": "", + "javaOuterClassname": "", + "javaMultipleFiles": false, + "javaGenerateEqualsAndHash": false, + "javaStringCheckUtf8": false, + "optimizeFor": 1, + "goPackage": "", + "ccGenericServices": false, + "javaGenericServices": false, + "pyGenericServices": false, + "phpGenericServices": false, + "deprecated": false, + "ccEnableArenas": false, + "objcClassPrefix": "", + "csharpNamespace": "", + "swiftPrefix": "", + "phpClassPrefix": "", + "phpNamespace": "", + "phpMetadataNamespace": "", + "rubyPackage": "", + "uninterpretedOption": [], + }, + "sourceCodeInfo": { "location": [] }, + "syntax": "proto3", + }), + references: { ".MyEnum": MyEnum }, + dependencies: [protoMetadata1, protoMetadata2], + options: { + options: { "my_file_option": "Hello world!" }, + messages: { + "MyMessage": { + options: { "my_message_option": 1234 }, + fields: { "foo": { "my_field_option": 4.5 } }, + oneof: { "qux": { "my_oneof_option": 42 } }, + }, + }, + services: { "MyService": { options: { "my_service_option": 0 }, methods: {} } }, + enums: { "MyEnum": { options: { "my_enum_option": true }, values: { "FOO": { "my_enum_value_option": 321 } } } }, + }, +}; diff --git a/integration/options-types-only/parameters.txt b/integration/options-types-only/parameters.txt new file mode 100644 index 000000000..5f22617d9 --- /dev/null +++ b/integration/options-types-only/parameters.txt @@ -0,0 +1 @@ +outputSchema=true,onlyTypes=true diff --git a/integration/options-types-only/something/something.bin b/integration/options-types-only/something/something.bin new file mode 100644 index 000000000..0950190ca Binary files /dev/null and b/integration/options-types-only/something/something.bin differ diff --git a/integration/options-types-only/something/something.proto b/integration/options-types-only/something/something.proto new file mode 100644 index 000000000..8e3f6705a --- /dev/null +++ b/integration/options-types-only/something/something.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +import "google/protobuf/descriptor.proto"; + +package something; + +extend google.protobuf.FieldOptions { + optional Something something = 1000; +} + +message Something { + string hello = 1; + repeated int32 foo = 2; +} diff --git a/integration/options-types-only/something/something.ts b/integration/options-types-only/something/something.ts new file mode 100644 index 000000000..cde92c0af --- /dev/null +++ b/integration/options-types-only/something/something.ts @@ -0,0 +1,100 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// source: something/something.proto + +/* eslint-disable */ +import { FileDescriptorProto as FileDescriptorProto1 } from "ts-proto-descriptors"; +import { protoMetadata as protoMetadata1 } from "../google/protobuf/descriptor"; + +export const protobufPackage = "something"; + +export interface Something { + hello: string; + foo: number[]; +} + +type ProtoMetaMessageOptions = { + options?: { [key: string]: any }; + fields?: { [key: string]: { [key: string]: any } }; + oneof?: { [key: string]: { [key: string]: any } }; + nested?: { [key: string]: ProtoMetaMessageOptions }; +}; + +export interface ProtoMetadata { + fileDescriptor: FileDescriptorProto1; + references: { [key: string]: any }; + dependencies?: ProtoMetadata[]; + options?: { + options?: { [key: string]: any }; + services?: { + [key: string]: { options?: { [key: string]: any }; methods?: { [key: string]: { [key: string]: any } } }; + }; + messages?: { [key: string]: ProtoMetaMessageOptions }; + enums?: { [key: string]: { options?: { [key: string]: any }; values?: { [key: string]: { [key: string]: any } } } }; + }; +} + +export const protoMetadata: ProtoMetadata = { + fileDescriptor: FileDescriptorProto1.fromPartial({ + "name": "something/something.proto", + "package": "something", + "dependency": ["google/protobuf/descriptor.proto"], + "publicDependency": [], + "weakDependency": [], + "messageType": [{ + "name": "Something", + "field": [{ + "name": "hello", + "number": 1, + "label": 1, + "type": 9, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "hello", + "options": undefined, + "proto3Optional": false, + }, { + "name": "foo", + "number": 2, + "label": 3, + "type": 5, + "typeName": "", + "extendee": "", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "foo", + "options": undefined, + "proto3Optional": false, + }], + "extension": [], + "nestedType": [], + "enumType": [], + "extensionRange": [], + "oneofDecl": [], + "options": undefined, + "reservedRange": [], + "reservedName": [], + }], + "enumType": [], + "service": [], + "extension": [{ + "name": "something", + "number": 1000, + "label": 1, + "type": 11, + "typeName": ".something.Something", + "extendee": ".google.protobuf.FieldOptions", + "defaultValue": "", + "oneofIndex": 0, + "jsonName": "something", + "options": undefined, + "proto3Optional": true, + }], + "options": undefined, + "sourceCodeInfo": { "location": [] }, + "syntax": "proto3", + }), + references: {}, + dependencies: [protoMetadata1], +}; diff --git a/src/schema.ts b/src/schema.ts index 2225f7903..86e08f768 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -236,7 +236,19 @@ function encodedOptionsToOptions( for (const key in encodedOptions) { const value = encodedOptions[key]; const extension = extensionCache[extendee][parseInt(key, 10) >>> 3]; - resultOptions.push(getExtensionValue(ctx, extension, value)); + if (shouldAddOptionDefinition(ctx, extension)) { + // todo: we should be able to create an option definition ALWAYS, however, + // we currently cannot do that because the if the extension is a sub-message + // (and thus, not just a straightforward value), we don't have an JSON object + // representation of the option - just it's encoded value. Our approach in + // getExtensionValue is to decode the encoded value into a message, but this + // Message.decode(...) method is not always included in the generated code. + // We should fix this so that we can always create an option definition by + // somehow premptively decoding the encoded value and then inserting it into + // the option defintion. + // please refer to inteegration/options-types-only to see this in action + resultOptions.push(getExtensionValue(ctx, extension, value)); + } } if (resultOptions.length == 0) { return undefined; @@ -244,6 +256,14 @@ function encodedOptionsToOptions( return code`{${joinCode(resultOptions, { on: "," })}}`; } +function shouldAddOptionDefinition(ctx: Context, extension: FieldDescriptorProto) { + return ( + extension.type !== FieldDescriptorProto_Type.TYPE_MESSAGE || + ctx.options.outputEncodeMethods === true || + ctx.options.outputEncodeMethods == "decode-only" + ); +} + function resolveMessageOptions(ctx: Context, message: DescriptorProto): Code | undefined { const fieldsOptions: Code[] = []; message.field.forEach((field) => {