diff --git a/protobuf/CHANGELOG.md b/protobuf/CHANGELOG.md index cd2605e31..d2f12ba70 100644 --- a/protobuf/CHANGELOG.md +++ b/protobuf/CHANGELOG.md @@ -4,9 +4,14 @@ added to convert the message into the [official protocol buffers text format][text format]. ([#1080], [#125]) +* Add [well-known proto types][wkts] as libraries. This change is required for + protoc_plugin-25.0.0. ([#1081]) + [text format]: https://protobuf.dev/reference/protobuf/textformat-spec/ [#1080]: https://github.com/google/protobuf.dart/pull/1080 [#125]: https://github.com/google/protobuf.dart/issues/125 +[wkts]: https://protobuf.dev/reference/protobuf/google.protobuf +[#1081]: https://github.com/google/protobuf.dart/pull/1081 ## 5.1.0 diff --git a/protobuf/build_wkts.sh b/protobuf/build_wkts.sh new file mode 100755 index 000000000..049be19c0 --- /dev/null +++ b/protobuf/build_wkts.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# This scripts generates the classes for well-known protobuf types which are +# included in the package. + +set -e +set -x + +mkdir -p lib/well_known_types/google/protobuf + +protoc \ + --dart_out=lib/well_known_types \ + --plugin=protoc-gen-dart=$(realpath '../protoc_plugin/bin/protoc-gen-dart-debug') \ + google/protobuf/*.proto + +# Remove empty .pbenum files. +rm lib/well_known_types/google/protobuf/any.pbenum.dart +rm lib/well_known_types/google/protobuf/api.pbenum.dart +rm lib/well_known_types/google/protobuf/duration.pbenum.dart +rm lib/well_known_types/google/protobuf/empty.pbenum.dart +rm lib/well_known_types/google/protobuf/field_mask.pbenum.dart +rm lib/well_known_types/google/protobuf/source_context.pbenum.dart +rm lib/well_known_types/google/protobuf/timestamp.pbenum.dart +rm lib/well_known_types/google/protobuf/wrappers.pbenum.dart diff --git a/protoc_plugin/test/protos/google/protobuf/any.proto b/protobuf/google/protobuf/any.proto similarity index 90% rename from protoc_plugin/test/protos/google/protobuf/any.proto rename to protobuf/google/protobuf/any.proto index 493294255..eff44e509 100644 --- a/protoc_plugin/test/protos/google/protobuf/any.proto +++ b/protobuf/google/protobuf/any.proto @@ -32,12 +32,12 @@ syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/any"; +option go_package = "google.golang.org/protobuf/types/known/anypb"; option java_package = "com.google.protobuf"; option java_outer_classname = "AnyProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // `Any` contains an arbitrary serialized protocol buffer message along with a // URL that describes the type of the serialized message. @@ -63,6 +63,10 @@ option objc_class_prefix = "GPB"; // if (any.is(Foo.class)) { // foo = any.unpack(Foo.class); // } +// // or ... +// if (any.isSameTypeAs(Foo.getDefaultInstance())) { +// foo = any.unpack(Foo.getDefaultInstance()); +// } // // Example 3: Pack and unpack a message in Python. // @@ -77,10 +81,13 @@ option objc_class_prefix = "GPB"; // Example 4: Pack and unpack a message in Go // // foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) +// any, err := anypb.New(foo) +// if err != nil { +// ... +// } // ... // foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// if err := any.UnmarshalTo(foo); err != nil { // ... // } // @@ -90,7 +97,6 @@ option objc_class_prefix = "GPB"; // in the type URL, for example "foo.bar.com/x/y.z" will yield type // name "y.z". // -// // JSON // ==== // The JSON representation of an `Any` value uses the regular @@ -121,7 +127,8 @@ option objc_class_prefix = "GPB"; // message Any { // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. The last segment of the URL's path must represent + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent // the fully qualified name of the type (as in // `path/google.protobuf.Duration`). The name should be in a canonical form // (e.g., leading "." is not accepted). @@ -142,7 +149,8 @@ message Any { // // Note: this functionality is not currently available in the official // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. + // type.googleapis.com. As of May 2023, there are no widely used type server + // implementations and no plans to implement one. // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. diff --git a/protoc_plugin/test/protos/google/protobuf/api.proto b/protobuf/google/protobuf/api.proto similarity index 85% rename from protoc_plugin/test/protos/google/protobuf/api.proto rename to protobuf/google/protobuf/api.proto index f37ee2fa4..c8f742543 100644 --- a/protoc_plugin/test/protos/google/protobuf/api.proto +++ b/protobuf/google/protobuf/api.proto @@ -35,12 +35,12 @@ package google.protobuf; import "google/protobuf/source_context.proto"; import "google/protobuf/type.proto"; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "ApiProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/api;api"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/apipb"; // Api is a light-weight descriptor for an API Interface. // @@ -51,8 +51,12 @@ option go_package = "google.golang.org/genproto/protobuf/api;api"; // sometimes simply referred to as "APIs" in other contexts, such as the name of // this message itself. See https://cloud.google.com/apis/design/glossary for // detailed terminology. +// +// New usages of this message as an alternative to ServiceDescriptorProto are +// strongly discouraged. This message does not reliability preserve all +// information necessary to model the schema and preserve semantics. Instead +// make use of FileDescriptorSet which preserves the necessary information. message Api { - // The fully qualified name of this interface, including package name // followed by the interface's simple name. string name = 1; @@ -83,7 +87,6 @@ message Api { // be omitted. Zero major versions must only be used for // experimental, non-GA interfaces. // - // string version = 4; // Source context for the protocol buffer service represented by this @@ -95,11 +98,18 @@ message Api { // The source syntax of the service. Syntax syntax = 7; + + // The source edition string, only valid when syntax is SYNTAX_EDITIONS. + string edition = 8; } // Method represents a method of an API interface. +// +// New usages of this message as an alternative to MethodDescriptorProto are +// strongly discouraged. This message does not reliability preserve all +// information necessary to model the schema and preserve semantics. Instead +// make use of FileDescriptorSet which preserves the necessary information. message Method { - // The simple name of this method. string name = 1; @@ -119,7 +129,16 @@ message Method { repeated Option options = 6; // The source syntax of this method. - Syntax syntax = 7; + // + // This field should be ignored, instead the syntax should be inherited from + // Api. This is similar to Field and EnumValue. + Syntax syntax = 7 [deprecated = true]; + + // The source edition string, only valid when syntax is SYNTAX_EDITIONS. + // + // This field should be ignored, instead the edition should be inherited from + // Api. This is similar to Field and EnumValue. + string edition = 8 [deprecated = true]; } // Declares an API Interface to be included in this interface. The including @@ -169,7 +188,7 @@ message Method { // The mixin construct implies that all methods in `AccessControl` are // also declared with same name and request/response types in // `Storage`. A documentation generator or annotation processor will -// see the effective `Storage.GetAcl` method after inherting +// see the effective `Storage.GetAcl` method after inheriting // documentation and annotations as follows: // // service Storage { diff --git a/protoc_plugin/protos/google/protobuf/duration.proto b/protobuf/google/protobuf/duration.proto similarity index 100% rename from protoc_plugin/protos/google/protobuf/duration.proto rename to protobuf/google/protobuf/duration.proto diff --git a/protoc_plugin/test/protos/google/protobuf/empty.proto b/protobuf/google/protobuf/empty.proto similarity index 94% rename from protoc_plugin/test/protos/google/protobuf/empty.proto rename to protobuf/google/protobuf/empty.proto index 03cacd233..b87c89dcf 100644 --- a/protoc_plugin/test/protos/google/protobuf/empty.proto +++ b/protobuf/google/protobuf/empty.proto @@ -32,12 +32,12 @@ syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "github.com/golang/protobuf/ptypes/empty"; +option go_package = "google.golang.org/protobuf/types/known/emptypb"; option java_package = "com.google.protobuf"; option java_outer_classname = "EmptyProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; // A generic empty message that you can re-use to avoid defining duplicated @@ -48,5 +48,4 @@ option cc_enable_arenas = true; // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); // } // -// The JSON representation for `Empty` is empty JSON object `{}`. message Empty {} diff --git a/protoc_plugin/test/protos/google/protobuf/field_mask.proto b/protobuf/google/protobuf/field_mask.proto similarity index 90% rename from protoc_plugin/test/protos/google/protobuf/field_mask.proto rename to protobuf/google/protobuf/field_mask.proto index 76e09f391..b28334b94 100644 --- a/protoc_plugin/test/protos/google/protobuf/field_mask.proto +++ b/protobuf/google/protobuf/field_mask.proto @@ -32,12 +32,13 @@ syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "FieldMaskProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/fieldmaskpb"; +option cc_enable_arenas = true; // `FieldMask` represents a set of symbolic field paths, for example: // @@ -107,57 +108,49 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; // describe the updated values, the API ignores the values of all // fields not covered by the mask. // -// If a repeated field is specified for an update operation, the existing -// repeated values in the target resource will be overwritten by the new values. -// Note that a repeated field is only allowed in the last position of a `paths` -// string. +// If a repeated field is specified for an update operation, new values will +// be appended to the existing repeated field in the target resource. Note that +// a repeated field is only allowed in the last position of a `paths` string. // // If a sub-message is specified in the last position of the field mask for an -// update operation, then the existing sub-message in the target resource is -// overwritten. Given the target message: +// update operation, then new value will be merged into the existing sub-message +// in the target resource. +// +// For example, given the target message: // // f { // b { -// d : 1 -// x : 2 +// d: 1 +// x: 2 // } -// c : 1 +// c: [1] // } // // And an update message: // // f { // b { -// d : 10 +// d: 10 // } +// c: [2] // } // // then if the field mask is: // -// paths: "f.b" +// paths: ["f.b", "f.c"] // // then the result will be: // // f { // b { -// d : 10 +// d: 10 +// x: 2 // } -// c : 1 +// c: [1, 2] // } // -// However, if the update mask was: -// -// paths: "f.b.d" -// -// then the result would be: -// -// f { -// b { -// d : 10 -// x : 2 -// } -// c : 1 -// } +// An implementation may provide options to override this default behavior for +// repeated and message fields. // // In order to reset a field's value to the default, the field must // be in the mask and set to the default value in the provided resource. @@ -245,7 +238,7 @@ option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask"; // // The implementation of any API method which has a FieldMask type field in the // request should verify the included field paths, and return an -// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. +// `INVALID_ARGUMENT` error if any path is unmappable. message FieldMask { // The set of field mask paths. repeated string paths = 1; diff --git a/protoc_plugin/test/protos/google/protobuf/source_context.proto b/protobuf/google/protobuf/source_context.proto similarity index 96% rename from protoc_plugin/test/protos/google/protobuf/source_context.proto rename to protobuf/google/protobuf/source_context.proto index f3b2c9668..135f50fea 100644 --- a/protoc_plugin/test/protos/google/protobuf/source_context.proto +++ b/protobuf/google/protobuf/source_context.proto @@ -32,12 +32,12 @@ syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "SourceContextProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/source_context;source_context"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/sourcecontextpb"; // `SourceContext` represents information about the source of a // protobuf element, like the file in which it is defined. diff --git a/protoc_plugin/test/protos/google/protobuf/struct.proto b/protobuf/google/protobuf/struct.proto similarity index 94% rename from protoc_plugin/test/protos/google/protobuf/struct.proto rename to protobuf/google/protobuf/struct.proto index 7d7808e7f..1bf0c1ad9 100644 --- a/protoc_plugin/test/protos/google/protobuf/struct.proto +++ b/protobuf/google/protobuf/struct.proto @@ -32,14 +32,13 @@ syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; +option go_package = "google.golang.org/protobuf/types/known/structpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "StructProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; - +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // `Struct` represents a structured data value, consisting of fields // which map to dynamically typed values. In some languages, `Struct` @@ -56,8 +55,8 @@ message Struct { // `Value` represents a dynamically typed value which can be either // null, a number, a string, a boolean, a recursive struct value, or a -// list of values. A producer of value is expected to set one of that -// variants, absence of any variant indicates an error. +// list of values. A producer of value is expected to set one of these +// variants. Absence of any variant indicates an error. // // The JSON representation for `Value` is JSON value. message Value { @@ -81,7 +80,7 @@ message Value { // `NullValue` is a singleton enumeration to represent the null value for the // `Value` type union. // -// The JSON representation for `NullValue` is JSON `null`. +// The JSON representation for `NullValue` is JSON `null`. enum NullValue { // Null value. NULL_VALUE = 0; diff --git a/protoc_plugin/test/protos/google/protobuf/timestamp.proto b/protobuf/google/protobuf/timestamp.proto similarity index 78% rename from protoc_plugin/test/protos/google/protobuf/timestamp.proto rename to protobuf/google/protobuf/timestamp.proto index 2b9e26a9b..6bc1efc6d 100644 --- a/protoc_plugin/test/protos/google/protobuf/timestamp.proto +++ b/protobuf/google/protobuf/timestamp.proto @@ -32,13 +32,13 @@ syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/timestamp"; +option go_package = "google.golang.org/protobuf/types/known/timestamppb"; option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // A Timestamp represents a point in time independent of any time zone or local // calendar, encoded as a count of seconds and fractions of seconds at @@ -90,8 +90,15 @@ option objc_class_prefix = "GPB"; // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) // .setNanos((int) ((millis % 1000) * 1000000)).build(); // +// Example 5: Compute Timestamp from Java `Instant.now()`. +// +// Instant now = Instant.now(); // -// Example 5: Compute Timestamp from current time in Python. +// Timestamp timestamp = +// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +// .setNanos(now.getNano()).build(); +// +// Example 6: Compute Timestamp from current time in Python. // // timestamp = Timestamp() // timestamp.GetCurrentTime() @@ -105,33 +112,34 @@ option objc_class_prefix = "GPB"; // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be +// is required. A ProtoJSON serializer should always use UTC (as indicated by +// "Z") when printing the Timestamp type and a ProtoJSON parser should be // able to accept both UTC and other timezones (as indicated by an offset). // // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // 01:30 UTC on January 15, 2017. // // In JavaScript, one can convert a Date object to this format using the -// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) +// standard +// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) // method. In Python, a standard `datetime.datetime` object can be converted -// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) -// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one -// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D +// to this format using +// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() // ) to obtain a formatter capable of generating timestamps in this format. // -// message Timestamp { - - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. + // Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + // be between -62135596800 and 253402300799 inclusive (which corresponds to + // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). int64 seconds = 1; - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 + // Non-negative fractions of a second at nanosecond resolution. This field is + // the nanosecond portion of the duration, not an alternative to seconds. + // Negative second values with fractions must still have non-negative nanos + // values that count forward in time. Must be between 0 and 999,999,999 // inclusive. int32 nanos = 2; } diff --git a/protoc_plugin/test/protos/google/protobuf/type.proto b/protobuf/google/protobuf/type.proto similarity index 72% rename from protoc_plugin/test/protos/google/protobuf/type.proto rename to protobuf/google/protobuf/type.proto index 624c15ee6..2c7615ed6 100644 --- a/protoc_plugin/test/protos/google/protobuf/type.proto +++ b/protobuf/google/protobuf/type.proto @@ -35,15 +35,20 @@ package google.protobuf; import "google/protobuf/any.proto"; import "google/protobuf/source_context.proto"; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; option java_package = "com.google.protobuf"; option java_outer_classname = "TypeProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option go_package = "google.golang.org/genproto/protobuf/ptype;ptype"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "google.golang.org/protobuf/types/known/typepb"; // A protocol buffer message type. +// +// New usages of this message as an alternative to DescriptorProto are strongly +// discouraged. This message does not reliability preserve all information +// necessary to model the schema and preserve semantics. Instead make use of +// FileDescriptorSet which preserves the necessary information. message Type { // The fully qualified message name. string name = 1; @@ -57,51 +62,58 @@ message Type { SourceContext source_context = 5; // The source syntax. Syntax syntax = 6; + // The source edition string, only valid when syntax is SYNTAX_EDITIONS. + string edition = 7; } // A single field of a message type. +// +// New usages of this message as an alternative to FieldDescriptorProto are +// strongly discouraged. This message does not reliability preserve all +// information necessary to model the schema and preserve semantics. Instead +// make use of FileDescriptorSet which preserves the necessary information. message Field { // Basic field types. enum Kind { // Field type unknown. - TYPE_UNKNOWN = 0; + TYPE_UNKNOWN = 0; // Field type double. - TYPE_DOUBLE = 1; + TYPE_DOUBLE = 1; // Field type float. - TYPE_FLOAT = 2; + TYPE_FLOAT = 2; // Field type int64. - TYPE_INT64 = 3; + TYPE_INT64 = 3; // Field type uint64. - TYPE_UINT64 = 4; + TYPE_UINT64 = 4; // Field type int32. - TYPE_INT32 = 5; + TYPE_INT32 = 5; // Field type fixed64. - TYPE_FIXED64 = 6; + TYPE_FIXED64 = 6; // Field type fixed32. - TYPE_FIXED32 = 7; + TYPE_FIXED32 = 7; // Field type bool. - TYPE_BOOL = 8; + TYPE_BOOL = 8; // Field type string. - TYPE_STRING = 9; + TYPE_STRING = 9; // Field type group. Proto2 syntax only, and deprecated. - TYPE_GROUP = 10; + TYPE_GROUP = 10; // Field type message. - TYPE_MESSAGE = 11; + TYPE_MESSAGE = 11; // Field type bytes. - TYPE_BYTES = 12; + TYPE_BYTES = 12; // Field type uint32. - TYPE_UINT32 = 13; + TYPE_UINT32 = 13; // Field type enum. - TYPE_ENUM = 14; + TYPE_ENUM = 14; // Field type sfixed32. - TYPE_SFIXED32 = 15; + TYPE_SFIXED32 = 15; // Field type sfixed64. - TYPE_SFIXED64 = 16; + TYPE_SFIXED64 = 16; // Field type sint32. - TYPE_SINT32 = 17; + TYPE_SINT32 = 17; // Field type sint64. - TYPE_SINT64 = 18; - }; + TYPE_SINT64 = 18; + } // Whether a field is optional, required, or repeated. enum Cardinality { @@ -113,7 +125,7 @@ message Field { CARDINALITY_REQUIRED = 2; // For repeated fields. CARDINALITY_REPEATED = 3; - }; + } // The field type. Kind kind = 1; @@ -140,6 +152,11 @@ message Field { } // Enum type definition. +// +// New usages of this message as an alternative to EnumDescriptorProto are +// strongly discouraged. This message does not reliability preserve all +// information necessary to model the schema and preserve semantics. Instead +// make use of FileDescriptorSet which preserves the necessary information. message Enum { // Enum type name. string name = 1; @@ -151,9 +168,16 @@ message Enum { SourceContext source_context = 4; // The source syntax. Syntax syntax = 5; + // The source edition string, only valid when syntax is SYNTAX_EDITIONS. + string edition = 6; } // Enum value definition. +// +// New usages of this message as an alternative to EnumValueDescriptorProto are +// strongly discouraged. This message does not reliability preserve all +// information necessary to model the schema and preserve semantics. Instead +// make use of FileDescriptorSet which preserves the necessary information. message EnumValue { // Enum value name. string name = 1; @@ -165,6 +189,10 @@ message EnumValue { // A protocol buffer option, which can be attached to a message, field, // enumeration, etc. +// +// New usages of this message as an alternative to FileOptions, MessageOptions, +// FieldOptions, EnumOptions, EnumValueOptions, ServiceOptions, or MethodOptions +// are strongly discouraged. message Option { // The option's name. For protobuf built-in options (options defined in // descriptor.proto), this is the short name. For example, `"map_entry"`. @@ -184,4 +212,6 @@ enum Syntax { SYNTAX_PROTO2 = 0; // Syntax `proto3`. SYNTAX_PROTO3 = 1; + // Syntax `editions`. + SYNTAX_EDITIONS = 2; } diff --git a/protoc_plugin/test/protos/google/protobuf/wrappers.proto b/protobuf/google/protobuf/wrappers.proto similarity index 63% rename from protoc_plugin/test/protos/google/protobuf/wrappers.proto rename to protobuf/google/protobuf/wrappers.proto index 01947639a..e583e7c40 100644 --- a/protoc_plugin/test/protos/google/protobuf/wrappers.proto +++ b/protobuf/google/protobuf/wrappers.proto @@ -27,27 +27,42 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Wrappers for primitive (non-message) types. These types are useful -// for embedding primitives in the `google.protobuf.Any` type and for places -// where we need to distinguish between the absence of a primitive -// typed field and its default value. +// +// Wrappers for primitive (non-message) types. These types were needed +// for legacy reasons and are not recommended for use in new APIs. +// +// Historically these wrappers were useful to have presence on proto3 primitive +// fields, but proto3 syntax has been updated to support the `optional` keyword. +// Using that keyword is now the strongly preferred way to add presence to +// proto3 primitive fields. +// +// A secondary usecase was to embed primitives in the `google.protobuf.Any` +// type: it is now recommended that you embed your value in your own wrapper +// message which can be specifically documented. +// +// These wrappers have no meaningful use within repeated fields as they lack +// the ability to detect presence on individual elements. +// These wrappers have no meaningful use within a map or a oneof since +// individual entries of a map or fields of a oneof can already detect presence. syntax = "proto3"; package google.protobuf; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option cc_enable_arenas = true; -option go_package = "github.com/golang/protobuf/ptypes/wrappers"; +option go_package = "google.golang.org/protobuf/types/known/wrapperspb"; option java_package = "com.google.protobuf"; option java_outer_classname = "WrappersProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; // Wrapper message for `double`. // // The JSON representation for `DoubleValue` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message DoubleValue { // The double value. double value = 1; @@ -56,6 +71,9 @@ message DoubleValue { // Wrapper message for `float`. // // The JSON representation for `FloatValue` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message FloatValue { // The float value. float value = 1; @@ -64,6 +82,9 @@ message FloatValue { // Wrapper message for `int64`. // // The JSON representation for `Int64Value` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message Int64Value { // The int64 value. int64 value = 1; @@ -72,6 +93,9 @@ message Int64Value { // Wrapper message for `uint64`. // // The JSON representation for `UInt64Value` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message UInt64Value { // The uint64 value. uint64 value = 1; @@ -80,6 +104,9 @@ message UInt64Value { // Wrapper message for `int32`. // // The JSON representation for `Int32Value` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message Int32Value { // The int32 value. int32 value = 1; @@ -88,6 +115,9 @@ message Int32Value { // Wrapper message for `uint32`. // // The JSON representation for `UInt32Value` is JSON number. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message UInt32Value { // The uint32 value. uint32 value = 1; @@ -96,6 +126,9 @@ message UInt32Value { // Wrapper message for `bool`. // // The JSON representation for `BoolValue` is JSON `true` and `false`. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message BoolValue { // The bool value. bool value = 1; @@ -104,6 +137,9 @@ message BoolValue { // Wrapper message for `string`. // // The JSON representation for `StringValue` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message StringValue { // The string value. string value = 1; @@ -112,6 +148,9 @@ message StringValue { // Wrapper message for `bytes`. // // The JSON representation for `BytesValue` is JSON string. +// +// Not recommended for use in new APIs, but still useful for legacy APIs and +// has no plan to be removed. message BytesValue { // The bytes value. bytes value = 1; diff --git a/protobuf/lib/well_known_types/google/protobuf/any.pb.dart b/protobuf/lib/well_known_types/google/protobuf/any.pb.dart new file mode 100644 index 000000000..2623677c1 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/any.pb.dart @@ -0,0 +1,217 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/any.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// `Any` contains an arbitrary serialized protocol buffer message along with a +/// URL that describes the type of the serialized message. +/// +/// Protobuf library provides support to pack/unpack Any values in the form +/// of utility functions or additional generated methods of the Any type. +/// +/// Example 1: Pack and unpack a message in C++. +/// +/// Foo foo = ...; +/// Any any; +/// any.PackFrom(foo); +/// ... +/// if (any.UnpackTo(&foo)) { +/// ... +/// } +/// +/// Example 2: Pack and unpack a message in Java. +/// +/// Foo foo = ...; +/// Any any = Any.pack(foo); +/// ... +/// if (any.is(Foo.class)) { +/// foo = any.unpack(Foo.class); +/// } +/// // or ... +/// if (any.isSameTypeAs(Foo.getDefaultInstance())) { +/// foo = any.unpack(Foo.getDefaultInstance()); +/// } +/// +/// Example 3: Pack and unpack a message in Python. +/// +/// foo = Foo(...) +/// any = Any() +/// any.Pack(foo) +/// ... +/// if any.Is(Foo.DESCRIPTOR): +/// any.Unpack(foo) +/// ... +/// +/// Example 4: Pack and unpack a message in Go +/// +/// foo := &pb.Foo{...} +/// any, err := anypb.New(foo) +/// if err != nil { +/// ... +/// } +/// ... +/// foo := &pb.Foo{} +/// if err := any.UnmarshalTo(foo); err != nil { +/// ... +/// } +/// +/// The pack methods provided by protobuf library will by default use +/// 'type.googleapis.com/full.type.name' as the type URL and the unpack +/// methods only use the fully qualified type name after the last '/' +/// in the type URL, for example "foo.bar.com/x/y.z" will yield type +/// name "y.z". +/// +/// JSON +/// ==== +/// The JSON representation of an `Any` value uses the regular +/// representation of the deserialized, embedded message, with an +/// additional field `@type` which contains the type URL. Example: +/// +/// package google.profile; +/// message Person { +/// string first_name = 1; +/// string last_name = 2; +/// } +/// +/// { +/// "@type": "type.googleapis.com/google.profile.Person", +/// "firstName": , +/// "lastName": +/// } +/// +/// If the embedded message type is well-known and has a custom JSON +/// representation, that representation will be embedded adding a field +/// `value` which holds the custom JSON in addition to the `@type` +/// field. Example (for message [google.protobuf.Duration][]): +/// +/// { +/// "@type": "type.googleapis.com/google.protobuf.Duration", +/// "value": "1.212s" +/// } +class Any extends $pb.GeneratedMessage with $mixin.AnyMixin { + factory Any({ + $core.String? typeUrl, + $core.List<$core.int>? value, + }) { + final result = create(); + if (typeUrl != null) result.typeUrl = typeUrl; + if (value != null) result.value = value; + return result; + } + + Any._(); + + factory Any.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Any.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Any', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.any) + ..aOS(1, _omitFieldNames ? '' : 'typeUrl') + ..a<$core.List<$core.int>>( + 2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.OY) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Any clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Any copyWith(void Function(Any) updates) => + super.copyWith((message) => updates(message as Any)) as Any; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Any create() => Any._(); + @$core.override + Any createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Any getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Any? _defaultInstance; + + /// A URL/resource name that uniquely identifies the type of the serialized + /// protocol buffer message. This string must contain at least + /// one "/" character. The last segment of the URL's path must represent + /// the fully qualified name of the type (as in + /// `path/google.protobuf.Duration`). The name should be in a canonical form + /// (e.g., leading "." is not accepted). + /// + /// In practice, teams usually precompile into the binary all types that they + /// expect it to use in the context of Any. However, for URLs which use the + /// scheme `http`, `https`, or no scheme, one can optionally set up a type + /// server that maps type URLs to message definitions as follows: + /// + /// * If no scheme is provided, `https` is assumed. + /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] + /// value in binary format, or produce an error. + /// * Applications are allowed to cache lookup results based on the + /// URL, or have them precompiled into a binary to avoid any + /// lookup. Therefore, binary compatibility needs to be preserved + /// on changes to types. (Use versioned type names to manage + /// breaking changes.) + /// + /// Note: this functionality is not currently available in the official + /// protobuf release, and it is not used for type URLs beginning with + /// type.googleapis.com. As of May 2023, there are no widely used type server + /// implementations and no plans to implement one. + /// + /// Schemes other than `http`, `https` (or the empty scheme) might be + /// used with implementation specific semantics. + @$pb.TagNumber(1) + $core.String get typeUrl => $_getSZ(0); + @$pb.TagNumber(1) + set typeUrl($core.String value) => $_setString(0, value); + @$pb.TagNumber(1) + $core.bool hasTypeUrl() => $_has(0); + @$pb.TagNumber(1) + void clearTypeUrl() => $_clearField(1); + + /// Must be a valid serialized protocol buffer of the above specified type. + @$pb.TagNumber(2) + $core.List<$core.int> get value => $_getN(1); + @$pb.TagNumber(2) + set value($core.List<$core.int> value) => $_setBytes(1, value); + @$pb.TagNumber(2) + $core.bool hasValue() => $_has(1); + @$pb.TagNumber(2) + void clearValue() => $_clearField(2); + + /// Creates a new [Any] encoding [message]. + /// + /// The [typeUrl] will be [typeUrlPrefix]/`fullName` where `fullName` is + /// the fully qualified name of the type of [message]. + static Any pack($pb.GeneratedMessage message, + {$core.String typeUrlPrefix = 'type.googleapis.com'}) { + final result = create(); + $mixin.AnyMixin.packIntoAny(result, message, typeUrlPrefix: typeUrlPrefix); + return result; + } +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/any.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/any.pbjson.dart new file mode 100644 index 000000000..2ae70933b --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/any.pbjson.dart @@ -0,0 +1,29 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/any.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use anyDescriptor instead') +const Any$json = { + '1': 'Any', + '2': [ + {'1': 'type_url', '3': 1, '4': 1, '5': 9, '10': 'typeUrl'}, + {'1': 'value', '3': 2, '4': 1, '5': 12, '10': 'value'}, + ], +}; + +/// Descriptor for `Any`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List anyDescriptor = $convert.base64Decode( + 'CgNBbnkSGQoIdHlwZV91cmwYASABKAlSB3R5cGVVcmwSFAoFdmFsdWUYAiABKAxSBXZhbHVl'); diff --git a/protobuf/lib/well_known_types/google/protobuf/api.pb.dart b/protobuf/lib/well_known_types/google/protobuf/api.pb.dart new file mode 100644 index 000000000..b2761060a --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/api.pb.dart @@ -0,0 +1,502 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/api.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/well_known_types/google/protobuf/source_context.pb.dart' + as $1; +import 'package:protobuf/well_known_types/google/protobuf/type.pb.dart' as $0; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// Api is a light-weight descriptor for an API Interface. +/// +/// Interfaces are also described as "protocol buffer services" in some contexts, +/// such as by the "service" keyword in a .proto file, but they are different +/// from API Services, which represent a concrete implementation of an interface +/// as opposed to simply a description of methods and bindings. They are also +/// sometimes simply referred to as "APIs" in other contexts, such as the name of +/// this message itself. See https://cloud.google.com/apis/design/glossary for +/// detailed terminology. +/// +/// New usages of this message as an alternative to ServiceDescriptorProto are +/// strongly discouraged. This message does not reliability preserve all +/// information necessary to model the schema and preserve semantics. Instead +/// make use of FileDescriptorSet which preserves the necessary information. +class Api extends $pb.GeneratedMessage { + factory Api({ + $core.String? name, + $core.Iterable? methods, + $core.Iterable<$0.Option>? options, + $core.String? version, + $1.SourceContext? sourceContext, + $core.Iterable? mixins, + $0.Syntax? syntax, + $core.String? edition, + }) { + final result = create(); + if (name != null) result.name = name; + if (methods != null) result.methods.addAll(methods); + if (options != null) result.options.addAll(options); + if (version != null) result.version = version; + if (sourceContext != null) result.sourceContext = sourceContext; + if (mixins != null) result.mixins.addAll(mixins); + if (syntax != null) result.syntax = syntax; + if (edition != null) result.edition = edition; + return result; + } + + Api._(); + + factory Api.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Api.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Api', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'name') + ..pPM(2, _omitFieldNames ? '' : 'methods', + subBuilder: Method.create) + ..pPM<$0.Option>(3, _omitFieldNames ? '' : 'options', + subBuilder: $0.Option.create) + ..aOS(4, _omitFieldNames ? '' : 'version') + ..aOM<$1.SourceContext>(5, _omitFieldNames ? '' : 'sourceContext', + subBuilder: $1.SourceContext.create) + ..pPM(6, _omitFieldNames ? '' : 'mixins', subBuilder: Mixin.create) + ..aE<$0.Syntax>(7, _omitFieldNames ? '' : 'syntax', + enumValues: $0.Syntax.values) + ..aOS(8, _omitFieldNames ? '' : 'edition') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Api clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Api copyWith(void Function(Api) updates) => + super.copyWith((message) => updates(message as Api)) as Api; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Api create() => Api._(); + @$core.override + Api createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Api getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Api? _defaultInstance; + + /// The fully qualified name of this interface, including package name + /// followed by the interface's simple name. + @$pb.TagNumber(1) + $core.String get name => $_getSZ(0); + @$pb.TagNumber(1) + set name($core.String value) => $_setString(0, value); + @$pb.TagNumber(1) + $core.bool hasName() => $_has(0); + @$pb.TagNumber(1) + void clearName() => $_clearField(1); + + /// The methods of this interface, in unspecified order. + @$pb.TagNumber(2) + $pb.PbList get methods => $_getList(1); + + /// Any metadata attached to the interface. + @$pb.TagNumber(3) + $pb.PbList<$0.Option> get options => $_getList(2); + + /// A version string for this interface. If specified, must have the form + /// `major-version.minor-version`, as in `1.10`. If the minor version is + /// omitted, it defaults to zero. If the entire version field is empty, the + /// major version is derived from the package name, as outlined below. If the + /// field is not empty, the version in the package name will be verified to be + /// consistent with what is provided here. + /// + /// The versioning schema uses [semantic + /// versioning](http://semver.org) where the major version number + /// indicates a breaking change and the minor version an additive, + /// non-breaking change. Both version numbers are signals to users + /// what to expect from different versions, and should be carefully + /// chosen based on the product plan. + /// + /// The major version is also reflected in the package name of the + /// interface, which must end in `v`, as in + /// `google.feature.v1`. For major versions 0 and 1, the suffix can + /// be omitted. Zero major versions must only be used for + /// experimental, non-GA interfaces. + @$pb.TagNumber(4) + $core.String get version => $_getSZ(3); + @$pb.TagNumber(4) + set version($core.String value) => $_setString(3, value); + @$pb.TagNumber(4) + $core.bool hasVersion() => $_has(3); + @$pb.TagNumber(4) + void clearVersion() => $_clearField(4); + + /// Source context for the protocol buffer service represented by this + /// message. + @$pb.TagNumber(5) + $1.SourceContext get sourceContext => $_getN(4); + @$pb.TagNumber(5) + set sourceContext($1.SourceContext value) => $_setField(5, value); + @$pb.TagNumber(5) + $core.bool hasSourceContext() => $_has(4); + @$pb.TagNumber(5) + void clearSourceContext() => $_clearField(5); + @$pb.TagNumber(5) + $1.SourceContext ensureSourceContext() => $_ensure(4); + + /// Included interfaces. See [Mixin][]. + @$pb.TagNumber(6) + $pb.PbList get mixins => $_getList(5); + + /// The source syntax of the service. + @$pb.TagNumber(7) + $0.Syntax get syntax => $_getN(6); + @$pb.TagNumber(7) + set syntax($0.Syntax value) => $_setField(7, value); + @$pb.TagNumber(7) + $core.bool hasSyntax() => $_has(6); + @$pb.TagNumber(7) + void clearSyntax() => $_clearField(7); + + /// The source edition string, only valid when syntax is SYNTAX_EDITIONS. + @$pb.TagNumber(8) + $core.String get edition => $_getSZ(7); + @$pb.TagNumber(8) + set edition($core.String value) => $_setString(7, value); + @$pb.TagNumber(8) + $core.bool hasEdition() => $_has(7); + @$pb.TagNumber(8) + void clearEdition() => $_clearField(8); +} + +/// Method represents a method of an API interface. +/// +/// New usages of this message as an alternative to MethodDescriptorProto are +/// strongly discouraged. This message does not reliability preserve all +/// information necessary to model the schema and preserve semantics. Instead +/// make use of FileDescriptorSet which preserves the necessary information. +class Method extends $pb.GeneratedMessage { + factory Method({ + $core.String? name, + $core.String? requestTypeUrl, + $core.bool? requestStreaming, + $core.String? responseTypeUrl, + $core.bool? responseStreaming, + $core.Iterable<$0.Option>? options, + @$core.Deprecated('This field is deprecated.') $0.Syntax? syntax, + @$core.Deprecated('This field is deprecated.') $core.String? edition, + }) { + final result = create(); + if (name != null) result.name = name; + if (requestTypeUrl != null) result.requestTypeUrl = requestTypeUrl; + if (requestStreaming != null) result.requestStreaming = requestStreaming; + if (responseTypeUrl != null) result.responseTypeUrl = responseTypeUrl; + if (responseStreaming != null) result.responseStreaming = responseStreaming; + if (options != null) result.options.addAll(options); + if (syntax != null) result.syntax = syntax; + if (edition != null) result.edition = edition; + return result; + } + + Method._(); + + factory Method.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Method.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Method', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'name') + ..aOS(2, _omitFieldNames ? '' : 'requestTypeUrl') + ..aOB(3, _omitFieldNames ? '' : 'requestStreaming') + ..aOS(4, _omitFieldNames ? '' : 'responseTypeUrl') + ..aOB(5, _omitFieldNames ? '' : 'responseStreaming') + ..pPM<$0.Option>(6, _omitFieldNames ? '' : 'options', + subBuilder: $0.Option.create) + ..aE<$0.Syntax>(7, _omitFieldNames ? '' : 'syntax', + enumValues: $0.Syntax.values) + ..aOS(8, _omitFieldNames ? '' : 'edition') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Method clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Method copyWith(void Function(Method) updates) => + super.copyWith((message) => updates(message as Method)) as Method; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Method create() => Method._(); + @$core.override + Method createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Method getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Method? _defaultInstance; + + /// The simple name of this method. + @$pb.TagNumber(1) + $core.String get name => $_getSZ(0); + @$pb.TagNumber(1) + set name($core.String value) => $_setString(0, value); + @$pb.TagNumber(1) + $core.bool hasName() => $_has(0); + @$pb.TagNumber(1) + void clearName() => $_clearField(1); + + /// A URL of the input message type. + @$pb.TagNumber(2) + $core.String get requestTypeUrl => $_getSZ(1); + @$pb.TagNumber(2) + set requestTypeUrl($core.String value) => $_setString(1, value); + @$pb.TagNumber(2) + $core.bool hasRequestTypeUrl() => $_has(1); + @$pb.TagNumber(2) + void clearRequestTypeUrl() => $_clearField(2); + + /// If true, the request is streamed. + @$pb.TagNumber(3) + $core.bool get requestStreaming => $_getBF(2); + @$pb.TagNumber(3) + set requestStreaming($core.bool value) => $_setBool(2, value); + @$pb.TagNumber(3) + $core.bool hasRequestStreaming() => $_has(2); + @$pb.TagNumber(3) + void clearRequestStreaming() => $_clearField(3); + + /// The URL of the output message type. + @$pb.TagNumber(4) + $core.String get responseTypeUrl => $_getSZ(3); + @$pb.TagNumber(4) + set responseTypeUrl($core.String value) => $_setString(3, value); + @$pb.TagNumber(4) + $core.bool hasResponseTypeUrl() => $_has(3); + @$pb.TagNumber(4) + void clearResponseTypeUrl() => $_clearField(4); + + /// If true, the response is streamed. + @$pb.TagNumber(5) + $core.bool get responseStreaming => $_getBF(4); + @$pb.TagNumber(5) + set responseStreaming($core.bool value) => $_setBool(4, value); + @$pb.TagNumber(5) + $core.bool hasResponseStreaming() => $_has(4); + @$pb.TagNumber(5) + void clearResponseStreaming() => $_clearField(5); + + /// Any metadata attached to the method. + @$pb.TagNumber(6) + $pb.PbList<$0.Option> get options => $_getList(5); + + /// The source syntax of this method. + /// + /// This field should be ignored, instead the syntax should be inherited from + /// Api. This is similar to Field and EnumValue. + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(7) + $0.Syntax get syntax => $_getN(6); + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(7) + set syntax($0.Syntax value) => $_setField(7, value); + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(7) + $core.bool hasSyntax() => $_has(6); + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(7) + void clearSyntax() => $_clearField(7); + + /// The source edition string, only valid when syntax is SYNTAX_EDITIONS. + /// + /// This field should be ignored, instead the edition should be inherited from + /// Api. This is similar to Field and EnumValue. + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(8) + $core.String get edition => $_getSZ(7); + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(8) + set edition($core.String value) => $_setString(7, value); + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(8) + $core.bool hasEdition() => $_has(7); + @$core.Deprecated('This field is deprecated.') + @$pb.TagNumber(8) + void clearEdition() => $_clearField(8); +} + +/// Declares an API Interface to be included in this interface. The including +/// interface must redeclare all the methods from the included interface, but +/// documentation and options are inherited as follows: +/// +/// - If after comment and whitespace stripping, the documentation +/// string of the redeclared method is empty, it will be inherited +/// from the original method. +/// +/// - Each annotation belonging to the service config (http, +/// visibility) which is not set in the redeclared method will be +/// inherited. +/// +/// - If an http annotation is inherited, the path pattern will be +/// modified as follows. Any version prefix will be replaced by the +/// version of the including interface plus the [root][] path if +/// specified. +/// +/// Example of a simple mixin: +/// +/// package google.acl.v1; +/// service AccessControl { +/// // Get the underlying ACL object. +/// rpc GetAcl(GetAclRequest) returns (Acl) { +/// option (google.api.http).get = "/v1/{resource=**}:getAcl"; +/// } +/// } +/// +/// package google.storage.v2; +/// service Storage { +/// rpc GetAcl(GetAclRequest) returns (Acl); +/// +/// // Get a data record. +/// rpc GetData(GetDataRequest) returns (Data) { +/// option (google.api.http).get = "/v2/{resource=**}"; +/// } +/// } +/// +/// Example of a mixin configuration: +/// +/// apis: +/// - name: google.storage.v2.Storage +/// mixins: +/// - name: google.acl.v1.AccessControl +/// +/// The mixin construct implies that all methods in `AccessControl` are +/// also declared with same name and request/response types in +/// `Storage`. A documentation generator or annotation processor will +/// see the effective `Storage.GetAcl` method after inheriting +/// documentation and annotations as follows: +/// +/// service Storage { +/// // Get the underlying ACL object. +/// rpc GetAcl(GetAclRequest) returns (Acl) { +/// option (google.api.http).get = "/v2/{resource=**}:getAcl"; +/// } +/// ... +/// } +/// +/// Note how the version in the path pattern changed from `v1` to `v2`. +/// +/// If the `root` field in the mixin is specified, it should be a +/// relative path under which inherited HTTP paths are placed. Example: +/// +/// apis: +/// - name: google.storage.v2.Storage +/// mixins: +/// - name: google.acl.v1.AccessControl +/// root: acls +/// +/// This implies the following inherited HTTP annotation: +/// +/// service Storage { +/// // Get the underlying ACL object. +/// rpc GetAcl(GetAclRequest) returns (Acl) { +/// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; +/// } +/// ... +/// } +class Mixin extends $pb.GeneratedMessage { + factory Mixin({ + $core.String? name, + $core.String? root, + }) { + final result = create(); + if (name != null) result.name = name; + if (root != null) result.root = root; + return result; + } + + Mixin._(); + + factory Mixin.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Mixin.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Mixin', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'name') + ..aOS(2, _omitFieldNames ? '' : 'root') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Mixin clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Mixin copyWith(void Function(Mixin) updates) => + super.copyWith((message) => updates(message as Mixin)) as Mixin; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Mixin create() => Mixin._(); + @$core.override + Mixin createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Mixin getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Mixin? _defaultInstance; + + /// The fully qualified name of the interface which is included. + @$pb.TagNumber(1) + $core.String get name => $_getSZ(0); + @$pb.TagNumber(1) + set name($core.String value) => $_setString(0, value); + @$pb.TagNumber(1) + $core.bool hasName() => $_has(0); + @$pb.TagNumber(1) + void clearName() => $_clearField(1); + + /// If non-empty specifies a path under which inherited HTTP paths + /// are rooted. + @$pb.TagNumber(2) + $core.String get root => $_getSZ(1); + @$pb.TagNumber(2) + set root($core.String value) => $_setString(1, value); + @$pb.TagNumber(2) + $core.bool hasRoot() => $_has(1); + @$pb.TagNumber(2) + void clearRoot() => $_clearField(2); +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/api.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/api.pbjson.dart new file mode 100644 index 000000000..f175b9d30 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/api.pbjson.dart @@ -0,0 +1,148 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/api.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use apiDescriptor instead') +const Api$json = { + '1': 'Api', + '2': [ + {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + { + '1': 'methods', + '3': 2, + '4': 3, + '5': 11, + '6': '.google.protobuf.Method', + '10': 'methods' + }, + { + '1': 'options', + '3': 3, + '4': 3, + '5': 11, + '6': '.google.protobuf.Option', + '10': 'options' + }, + {'1': 'version', '3': 4, '4': 1, '5': 9, '10': 'version'}, + { + '1': 'source_context', + '3': 5, + '4': 1, + '5': 11, + '6': '.google.protobuf.SourceContext', + '10': 'sourceContext' + }, + { + '1': 'mixins', + '3': 6, + '4': 3, + '5': 11, + '6': '.google.protobuf.Mixin', + '10': 'mixins' + }, + { + '1': 'syntax', + '3': 7, + '4': 1, + '5': 14, + '6': '.google.protobuf.Syntax', + '10': 'syntax' + }, + {'1': 'edition', '3': 8, '4': 1, '5': 9, '10': 'edition'}, + ], +}; + +/// Descriptor for `Api`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List apiDescriptor = $convert.base64Decode( + 'CgNBcGkSEgoEbmFtZRgBIAEoCVIEbmFtZRIxCgdtZXRob2RzGAIgAygLMhcuZ29vZ2xlLnByb3' + 'RvYnVmLk1ldGhvZFIHbWV0aG9kcxIxCgdvcHRpb25zGAMgAygLMhcuZ29vZ2xlLnByb3RvYnVm' + 'Lk9wdGlvblIHb3B0aW9ucxIYCgd2ZXJzaW9uGAQgASgJUgd2ZXJzaW9uEkUKDnNvdXJjZV9jb2' + '50ZXh0GAUgASgLMh4uZ29vZ2xlLnByb3RvYnVmLlNvdXJjZUNvbnRleHRSDXNvdXJjZUNvbnRl' + 'eHQSLgoGbWl4aW5zGAYgAygLMhYuZ29vZ2xlLnByb3RvYnVmLk1peGluUgZtaXhpbnMSLwoGc3' + 'ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRheFIGc3ludGF4EhgKB2VkaXRpb24Y' + 'CCABKAlSB2VkaXRpb24='); + +@$core.Deprecated('Use methodDescriptor instead') +const Method$json = { + '1': 'Method', + '2': [ + {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + {'1': 'request_type_url', '3': 2, '4': 1, '5': 9, '10': 'requestTypeUrl'}, + { + '1': 'request_streaming', + '3': 3, + '4': 1, + '5': 8, + '10': 'requestStreaming' + }, + {'1': 'response_type_url', '3': 4, '4': 1, '5': 9, '10': 'responseTypeUrl'}, + { + '1': 'response_streaming', + '3': 5, + '4': 1, + '5': 8, + '10': 'responseStreaming' + }, + { + '1': 'options', + '3': 6, + '4': 3, + '5': 11, + '6': '.google.protobuf.Option', + '10': 'options' + }, + { + '1': 'syntax', + '3': 7, + '4': 1, + '5': 14, + '6': '.google.protobuf.Syntax', + '8': {'3': true}, + '10': 'syntax', + }, + { + '1': 'edition', + '3': 8, + '4': 1, + '5': 9, + '8': {'3': true}, + '10': 'edition', + }, + ], +}; + +/// Descriptor for `Method`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List methodDescriptor = $convert.base64Decode( + 'CgZNZXRob2QSEgoEbmFtZRgBIAEoCVIEbmFtZRIoChByZXF1ZXN0X3R5cGVfdXJsGAIgASgJUg' + '5yZXF1ZXN0VHlwZVVybBIrChFyZXF1ZXN0X3N0cmVhbWluZxgDIAEoCFIQcmVxdWVzdFN0cmVh' + 'bWluZxIqChFyZXNwb25zZV90eXBlX3VybBgEIAEoCVIPcmVzcG9uc2VUeXBlVXJsEi0KEnJlc3' + 'BvbnNlX3N0cmVhbWluZxgFIAEoCFIRcmVzcG9uc2VTdHJlYW1pbmcSMQoHb3B0aW9ucxgGIAMo' + 'CzIXLmdvb2dsZS5wcm90b2J1Zi5PcHRpb25SB29wdGlvbnMSMwoGc3ludGF4GAcgASgOMhcuZ2' + '9vZ2xlLnByb3RvYnVmLlN5bnRheEICGAFSBnN5bnRheBIcCgdlZGl0aW9uGAggASgJQgIYAVIH' + 'ZWRpdGlvbg=='); + +@$core.Deprecated('Use mixinDescriptor instead') +const Mixin$json = { + '1': 'Mixin', + '2': [ + {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + {'1': 'root', '3': 2, '4': 1, '5': 9, '10': 'root'}, + ], +}; + +/// Descriptor for `Mixin`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List mixinDescriptor = $convert.base64Decode( + 'CgVNaXhpbhISCgRuYW1lGAEgASgJUgRuYW1lEhIKBHJvb3QYAiABKAlSBHJvb3Q='); diff --git a/protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart b/protobuf/lib/well_known_types/google/protobuf/duration.pb.dart similarity index 98% rename from protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart rename to protobuf/lib/well_known_types/google/protobuf/duration.pb.dart index bd08462f6..1d2be314c 100644 --- a/protoc_plugin/lib/src/gen/google/protobuf/duration.pb.dart +++ b/protobuf/lib/well_known_types/google/protobuf/duration.pb.dart @@ -9,7 +9,7 @@ // ignore_for_file: curly_braces_in_flow_control_structures // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports, library_prefixes -// ignore_for_file: non_constant_identifier_names +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports import 'dart:core' as $core; diff --git a/protobuf/lib/well_known_types/google/protobuf/duration.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/duration.pbjson.dart new file mode 100644 index 000000000..8a9047b96 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/duration.pbjson.dart @@ -0,0 +1,30 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/duration.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use durationDescriptor instead') +const Duration$json = { + '1': 'Duration', + '2': [ + {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'}, + {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'}, + ], +}; + +/// Descriptor for `Duration`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List durationDescriptor = $convert.base64Decode( + 'CghEdXJhdGlvbhIYCgdzZWNvbmRzGAEgASgDUgdzZWNvbmRzEhQKBW5hbm9zGAIgASgFUgVuYW' + '5vcw=='); diff --git a/protobuf/lib/well_known_types/google/protobuf/empty.pb.dart b/protobuf/lib/well_known_types/google/protobuf/empty.pb.dart new file mode 100644 index 000000000..8c77bb7d1 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/empty.pb.dart @@ -0,0 +1,65 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/empty.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +class Empty extends $pb.GeneratedMessage { + factory Empty() => create(); + + Empty._(); + + factory Empty.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Empty.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Empty', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Empty clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Empty copyWith(void Function(Empty) updates) => + super.copyWith((message) => updates(message as Empty)) as Empty; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Empty create() => Empty._(); + @$core.override + Empty createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Empty getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Empty? _defaultInstance; +} + +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/empty.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/empty.pbjson.dart new file mode 100644 index 000000000..07cdbb30b --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/empty.pbjson.dart @@ -0,0 +1,25 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/empty.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use emptyDescriptor instead') +const Empty$json = { + '1': 'Empty', +}; + +/// Descriptor for `Empty`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List emptyDescriptor = + $convert.base64Decode('CgVFbXB0eQ=='); diff --git a/protobuf/lib/well_known_types/google/protobuf/field_mask.pb.dart b/protobuf/lib/well_known_types/google/protobuf/field_mask.pb.dart new file mode 100644 index 000000000..a41c1e730 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/field_mask.pb.dart @@ -0,0 +1,273 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/field_mask.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// `FieldMask` represents a set of symbolic field paths, for example: +/// +/// paths: "f.a" +/// paths: "f.b.d" +/// +/// Here `f` represents a field in some root message, `a` and `b` +/// fields in the message found in `f`, and `d` a field found in the +/// message in `f.b`. +/// +/// Field masks are used to specify a subset of fields that should be +/// returned by a get operation or modified by an update operation. +/// Field masks also have a custom JSON encoding (see below). +/// +/// # Field Masks in Projections +/// +/// When used in the context of a projection, a response message or +/// sub-message is filtered by the API to only contain those fields as +/// specified in the mask. For example, if the mask in the previous +/// example is applied to a response message as follows: +/// +/// f { +/// a : 22 +/// b { +/// d : 1 +/// x : 2 +/// } +/// y : 13 +/// } +/// z: 8 +/// +/// The result will not contain specific values for fields x,y and z +/// (their value will be set to the default, and omitted in proto text +/// output): +/// +/// +/// f { +/// a : 22 +/// b { +/// d : 1 +/// } +/// } +/// +/// A repeated field is not allowed except at the last position of a +/// paths string. +/// +/// If a FieldMask object is not present in a get operation, the +/// operation applies to all fields (as if a FieldMask of all fields +/// had been specified). +/// +/// Note that a field mask does not necessarily apply to the +/// top-level response message. In case of a REST get operation, the +/// field mask applies directly to the response, but in case of a REST +/// list operation, the mask instead applies to each individual message +/// in the returned resource list. In case of a REST custom method, +/// other definitions may be used. Where the mask applies will be +/// clearly documented together with its declaration in the API. In +/// any case, the effect on the returned resource/resources is required +/// behavior for APIs. +/// +/// # Field Masks in Update Operations +/// +/// A field mask in update operations specifies which fields of the +/// targeted resource are going to be updated. The API is required +/// to only change the values of the fields as specified in the mask +/// and leave the others untouched. If a resource is passed in to +/// describe the updated values, the API ignores the values of all +/// fields not covered by the mask. +/// +/// If a repeated field is specified for an update operation, new values will +/// be appended to the existing repeated field in the target resource. Note that +/// a repeated field is only allowed in the last position of a `paths` string. +/// +/// If a sub-message is specified in the last position of the field mask for an +/// update operation, then new value will be merged into the existing sub-message +/// in the target resource. +/// +/// For example, given the target message: +/// +/// f { +/// b { +/// d: 1 +/// x: 2 +/// } +/// c: [1] +/// } +/// +/// And an update message: +/// +/// f { +/// b { +/// d: 10 +/// } +/// c: [2] +/// } +/// +/// then if the field mask is: +/// +/// paths: ["f.b", "f.c"] +/// +/// then the result will be: +/// +/// f { +/// b { +/// d: 10 +/// x: 2 +/// } +/// c: [1, 2] +/// } +/// +/// An implementation may provide options to override this default behavior for +/// repeated and message fields. +/// +/// In order to reset a field's value to the default, the field must +/// be in the mask and set to the default value in the provided resource. +/// Hence, in order to reset all fields of a resource, provide a default +/// instance of the resource and set all fields in the mask, or do +/// not provide a mask as described below. +/// +/// If a field mask is not present on update, the operation applies to +/// all fields (as if a field mask of all fields has been specified). +/// Note that in the presence of schema evolution, this may mean that +/// fields the client does not know and has therefore not filled into +/// the request will be reset to their default. If this is unwanted +/// behavior, a specific service may require a client to always specify +/// a field mask, producing an error if not. +/// +/// As with get operations, the location of the resource which +/// describes the updated values in the request message depends on the +/// operation kind. In any case, the effect of the field mask is +/// required to be honored by the API. +/// +/// ## Considerations for HTTP REST +/// +/// The HTTP kind of an update operation which uses a field mask must +/// be set to PATCH instead of PUT in order to satisfy HTTP semantics +/// (PUT must only be used for full updates). +/// +/// # JSON Encoding of Field Masks +/// +/// In JSON, a field mask is encoded as a single string where paths are +/// separated by a comma. Fields name in each path are converted +/// to/from lower-camel naming conventions. +/// +/// As an example, consider the following message declarations: +/// +/// message Profile { +/// User user = 1; +/// Photo photo = 2; +/// } +/// message User { +/// string display_name = 1; +/// string address = 2; +/// } +/// +/// In proto a field mask for `Profile` may look as such: +/// +/// mask { +/// paths: "user.display_name" +/// paths: "photo" +/// } +/// +/// In JSON, the same mask is represented as below: +/// +/// { +/// mask: "user.displayName,photo" +/// } +/// +/// # Field Masks and Oneof Fields +/// +/// Field masks treat fields in oneofs just as regular fields. Consider the +/// following message: +/// +/// message SampleMessage { +/// oneof test_oneof { +/// string name = 4; +/// SubMessage sub_message = 9; +/// } +/// } +/// +/// The field mask can be: +/// +/// mask { +/// paths: "name" +/// } +/// +/// Or: +/// +/// mask { +/// paths: "sub_message" +/// } +/// +/// Note that oneof type names ("test_oneof" in this case) cannot be used in +/// paths. +/// +/// ## Field Mask Verification +/// +/// The implementation of any API method which has a FieldMask type field in the +/// request should verify the included field paths, and return an +/// `INVALID_ARGUMENT` error if any path is unmappable. +class FieldMask extends $pb.GeneratedMessage with $mixin.FieldMaskMixin { + factory FieldMask({ + $core.Iterable<$core.String>? paths, + }) { + final result = create(); + if (paths != null) result.paths.addAll(paths); + return result; + } + + FieldMask._(); + + factory FieldMask.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory FieldMask.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'FieldMask', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.fieldMask) + ..pPS(1, _omitFieldNames ? '' : 'paths') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + FieldMask clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + FieldMask copyWith(void Function(FieldMask) updates) => + super.copyWith((message) => updates(message as FieldMask)) as FieldMask; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static FieldMask create() => FieldMask._(); + @$core.override + FieldMask createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static FieldMask getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static FieldMask? _defaultInstance; + + /// The set of field mask paths. + @$pb.TagNumber(1) + $pb.PbList<$core.String> get paths => $_getList(0); +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/field_mask.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/field_mask.pbjson.dart new file mode 100644 index 000000000..7bd6b2d31 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/field_mask.pbjson.dart @@ -0,0 +1,28 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/field_mask.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use fieldMaskDescriptor instead') +const FieldMask$json = { + '1': 'FieldMask', + '2': [ + {'1': 'paths', '3': 1, '4': 3, '5': 9, '10': 'paths'}, + ], +}; + +/// Descriptor for `FieldMask`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List fieldMaskDescriptor = + $convert.base64Decode('CglGaWVsZE1hc2sSFAoFcGF0aHMYASADKAlSBXBhdGhz'); diff --git a/protobuf/lib/well_known_types/google/protobuf/source_context.pb.dart b/protobuf/lib/well_known_types/google/protobuf/source_context.pb.dart new file mode 100644 index 000000000..b2663260f --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/source_context.pb.dart @@ -0,0 +1,81 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/source_context.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// `SourceContext` represents information about the source of a +/// protobuf element, like the file in which it is defined. +class SourceContext extends $pb.GeneratedMessage { + factory SourceContext({ + $core.String? fileName, + }) { + final result = create(); + if (fileName != null) result.fileName = fileName; + return result; + } + + SourceContext._(); + + factory SourceContext.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory SourceContext.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'SourceContext', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create) + ..aOS(1, _omitFieldNames ? '' : 'fileName') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + SourceContext clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + SourceContext copyWith(void Function(SourceContext) updates) => + super.copyWith((message) => updates(message as SourceContext)) + as SourceContext; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static SourceContext create() => SourceContext._(); + @$core.override + SourceContext createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static SourceContext getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); + static SourceContext? _defaultInstance; + + /// The path-qualified name of the .proto file that contained the associated + /// protobuf element. For example: `"google/protobuf/source_context.proto"`. + @$pb.TagNumber(1) + $core.String get fileName => $_getSZ(0); + @$pb.TagNumber(1) + set fileName($core.String value) => $_setString(0, value); + @$pb.TagNumber(1) + $core.bool hasFileName() => $_has(0); + @$pb.TagNumber(1) + void clearFileName() => $_clearField(1); +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/source_context.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/source_context.pbjson.dart new file mode 100644 index 000000000..b607f9e1e --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/source_context.pbjson.dart @@ -0,0 +1,28 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/source_context.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use sourceContextDescriptor instead') +const SourceContext$json = { + '1': 'SourceContext', + '2': [ + {'1': 'file_name', '3': 1, '4': 1, '5': 9, '10': 'fileName'}, + ], +}; + +/// Descriptor for `SourceContext`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List sourceContextDescriptor = $convert.base64Decode( + 'Cg1Tb3VyY2VDb250ZXh0EhsKCWZpbGVfbmFtZRgBIAEoCVIIZmlsZU5hbWU='); diff --git a/protobuf/lib/well_known_types/google/protobuf/struct.pb.dart b/protobuf/lib/well_known_types/google/protobuf/struct.pb.dart new file mode 100644 index 000000000..ba3ba129d --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/struct.pb.dart @@ -0,0 +1,312 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/struct.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; +import 'package:protobuf/well_known_types/google/protobuf/struct.pbenum.dart'; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; +export 'package:protobuf/well_known_types/google/protobuf/struct.pbenum.dart'; + +/// `Struct` represents a structured data value, consisting of fields +/// which map to dynamically typed values. In some languages, `Struct` +/// might be supported by a native representation. For example, in +/// scripting languages like JS a struct is represented as an +/// object. The details of that representation are described together +/// with the proto support for the language. +/// +/// The JSON representation for `Struct` is JSON object. +class Struct extends $pb.GeneratedMessage with $mixin.StructMixin { + factory Struct({ + $core.Iterable<$core.MapEntry<$core.String, Value>>? fields, + }) { + final result = create(); + if (fields != null) result.fields.addEntries(fields); + return result; + } + + Struct._(); + + factory Struct.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Struct.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Struct', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.struct) + ..m<$core.String, Value>(1, _omitFieldNames ? '' : 'fields', + entryClassName: 'Struct.FieldsEntry', + keyFieldType: $pb.PbFieldType.OS, + valueFieldType: $pb.PbFieldType.OM, + valueCreator: Value.create, + valueDefaultOrMaker: Value.getDefault, + packageName: const $pb.PackageName('google.protobuf')) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Struct clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Struct copyWith(void Function(Struct) updates) => + super.copyWith((message) => updates(message as Struct)) as Struct; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Struct create() => Struct._(); + @$core.override + Struct createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Struct getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Struct? _defaultInstance; + + /// Unordered map of dynamically typed values. + @$pb.TagNumber(1) + $pb.PbMap<$core.String, Value> get fields => $_getMap(0); +} + +enum Value_Kind { + nullValue, + numberValue, + stringValue, + boolValue, + structValue, + listValue, + notSet +} + +/// `Value` represents a dynamically typed value which can be either +/// null, a number, a string, a boolean, a recursive struct value, or a +/// list of values. A producer of value is expected to set one of these +/// variants. Absence of any variant indicates an error. +/// +/// The JSON representation for `Value` is JSON value. +class Value extends $pb.GeneratedMessage with $mixin.ValueMixin { + factory Value({ + NullValue? nullValue, + $core.double? numberValue, + $core.String? stringValue, + $core.bool? boolValue, + Struct? structValue, + ListValue? listValue, + }) { + final result = create(); + if (nullValue != null) result.nullValue = nullValue; + if (numberValue != null) result.numberValue = numberValue; + if (stringValue != null) result.stringValue = stringValue; + if (boolValue != null) result.boolValue = boolValue; + if (structValue != null) result.structValue = structValue; + if (listValue != null) result.listValue = listValue; + return result; + } + + Value._(); + + factory Value.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Value.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static const $core.Map<$core.int, Value_Kind> _Value_KindByTag = { + 1: Value_Kind.nullValue, + 2: Value_Kind.numberValue, + 3: Value_Kind.stringValue, + 4: Value_Kind.boolValue, + 5: Value_Kind.structValue, + 6: Value_Kind.listValue, + 0: Value_Kind.notSet + }; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Value', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.value) + ..oo(0, [1, 2, 3, 4, 5, 6]) + ..aE(1, _omitFieldNames ? '' : 'nullValue', + enumValues: NullValue.values) + ..aD(2, _omitFieldNames ? '' : 'numberValue') + ..aOS(3, _omitFieldNames ? '' : 'stringValue') + ..aOB(4, _omitFieldNames ? '' : 'boolValue') + ..aOM(5, _omitFieldNames ? '' : 'structValue', + subBuilder: Struct.create) + ..aOM(6, _omitFieldNames ? '' : 'listValue', + subBuilder: ListValue.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Value clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Value copyWith(void Function(Value) updates) => + super.copyWith((message) => updates(message as Value)) as Value; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Value create() => Value._(); + @$core.override + Value createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Value getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Value? _defaultInstance; + + @$pb.TagNumber(1) + @$pb.TagNumber(2) + @$pb.TagNumber(3) + @$pb.TagNumber(4) + @$pb.TagNumber(5) + @$pb.TagNumber(6) + Value_Kind whichKind() => _Value_KindByTag[$_whichOneof(0)]!; + @$pb.TagNumber(1) + @$pb.TagNumber(2) + @$pb.TagNumber(3) + @$pb.TagNumber(4) + @$pb.TagNumber(5) + @$pb.TagNumber(6) + void clearKind() => $_clearField($_whichOneof(0)); + + /// Represents a null value. + @$pb.TagNumber(1) + NullValue get nullValue => $_getN(0); + @$pb.TagNumber(1) + set nullValue(NullValue value) => $_setField(1, value); + @$pb.TagNumber(1) + $core.bool hasNullValue() => $_has(0); + @$pb.TagNumber(1) + void clearNullValue() => $_clearField(1); + + /// Represents a double value. + @$pb.TagNumber(2) + $core.double get numberValue => $_getN(1); + @$pb.TagNumber(2) + set numberValue($core.double value) => $_setDouble(1, value); + @$pb.TagNumber(2) + $core.bool hasNumberValue() => $_has(1); + @$pb.TagNumber(2) + void clearNumberValue() => $_clearField(2); + + /// Represents a string value. + @$pb.TagNumber(3) + $core.String get stringValue => $_getSZ(2); + @$pb.TagNumber(3) + set stringValue($core.String value) => $_setString(2, value); + @$pb.TagNumber(3) + $core.bool hasStringValue() => $_has(2); + @$pb.TagNumber(3) + void clearStringValue() => $_clearField(3); + + /// Represents a boolean value. + @$pb.TagNumber(4) + $core.bool get boolValue => $_getBF(3); + @$pb.TagNumber(4) + set boolValue($core.bool value) => $_setBool(3, value); + @$pb.TagNumber(4) + $core.bool hasBoolValue() => $_has(3); + @$pb.TagNumber(4) + void clearBoolValue() => $_clearField(4); + + /// Represents a structured value. + @$pb.TagNumber(5) + Struct get structValue => $_getN(4); + @$pb.TagNumber(5) + set structValue(Struct value) => $_setField(5, value); + @$pb.TagNumber(5) + $core.bool hasStructValue() => $_has(4); + @$pb.TagNumber(5) + void clearStructValue() => $_clearField(5); + @$pb.TagNumber(5) + Struct ensureStructValue() => $_ensure(4); + + /// Represents a repeated `Value`. + @$pb.TagNumber(6) + ListValue get listValue => $_getN(5); + @$pb.TagNumber(6) + set listValue(ListValue value) => $_setField(6, value); + @$pb.TagNumber(6) + $core.bool hasListValue() => $_has(5); + @$pb.TagNumber(6) + void clearListValue() => $_clearField(6); + @$pb.TagNumber(6) + ListValue ensureListValue() => $_ensure(5); +} + +/// `ListValue` is a wrapper around a repeated field of values. +/// +/// The JSON representation for `ListValue` is JSON array. +class ListValue extends $pb.GeneratedMessage with $mixin.ListValueMixin { + factory ListValue({ + $core.Iterable? values, + }) { + final result = create(); + if (values != null) result.values.addAll(values); + return result; + } + + ListValue._(); + + factory ListValue.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory ListValue.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'ListValue', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.listValue) + ..pPM(1, _omitFieldNames ? '' : 'values', subBuilder: Value.create) + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + ListValue clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + ListValue copyWith(void Function(ListValue) updates) => + super.copyWith((message) => updates(message as ListValue)) as ListValue; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static ListValue create() => ListValue._(); + @$core.override + ListValue createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static ListValue getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ListValue? _defaultInstance; + + /// Repeated field of dynamically typed values. + @$pb.TagNumber(1) + $pb.PbList get values => $_getList(0); +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/struct.pbenum.dart b/protobuf/lib/well_known_types/google/protobuf/struct.pbenum.dart new file mode 100644 index 000000000..47342062a --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/struct.pbenum.dart @@ -0,0 +1,39 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/struct.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; + +/// `NullValue` is a singleton enumeration to represent the null value for the +/// `Value` type union. +/// +/// The JSON representation for `NullValue` is JSON `null`. +class NullValue extends $pb.ProtobufEnum { + /// Null value. + static const NullValue NULL_VALUE = + NullValue._(0, _omitEnumNames ? '' : 'NULL_VALUE'); + + static const $core.List values = [ + NULL_VALUE, + ]; + + static final $core.List _byValue = + $pb.ProtobufEnum.$_initByValueList(values, 0); + static NullValue? valueOf($core.int value) => + value < 0 || value >= _byValue.length ? null : _byValue[value]; + + const NullValue._(super.value, super.name); +} + +const $core.bool _omitEnumNames = + $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/struct.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/struct.pbjson.dart new file mode 100644 index 000000000..a8d906a5d --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/struct.pbjson.dart @@ -0,0 +1,136 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/struct.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use nullValueDescriptor instead') +const NullValue$json = { + '1': 'NullValue', + '2': [ + {'1': 'NULL_VALUE', '2': 0}, + ], +}; + +/// Descriptor for `NullValue`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List nullValueDescriptor = + $convert.base64Decode('CglOdWxsVmFsdWUSDgoKTlVMTF9WQUxVRRAA'); + +@$core.Deprecated('Use structDescriptor instead') +const Struct$json = { + '1': 'Struct', + '2': [ + { + '1': 'fields', + '3': 1, + '4': 3, + '5': 11, + '6': '.google.protobuf.Struct.FieldsEntry', + '10': 'fields' + }, + ], + '3': [Struct_FieldsEntry$json], +}; + +@$core.Deprecated('Use structDescriptor instead') +const Struct_FieldsEntry$json = { + '1': 'FieldsEntry', + '2': [ + {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, + { + '1': 'value', + '3': 2, + '4': 1, + '5': 11, + '6': '.google.protobuf.Value', + '10': 'value' + }, + ], + '7': {'7': true}, +}; + +/// Descriptor for `Struct`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List structDescriptor = $convert.base64Decode( + 'CgZTdHJ1Y3QSOwoGZmllbGRzGAEgAygLMiMuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdC5GaWVsZH' + 'NFbnRyeVIGZmllbGRzGlEKC0ZpZWxkc0VudHJ5EhAKA2tleRgBIAEoCVIDa2V5EiwKBXZhbHVl' + 'GAIgASgLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlUgV2YWx1ZToCOAE='); + +@$core.Deprecated('Use valueDescriptor instead') +const Value$json = { + '1': 'Value', + '2': [ + { + '1': 'null_value', + '3': 1, + '4': 1, + '5': 14, + '6': '.google.protobuf.NullValue', + '9': 0, + '10': 'nullValue' + }, + {'1': 'number_value', '3': 2, '4': 1, '5': 1, '9': 0, '10': 'numberValue'}, + {'1': 'string_value', '3': 3, '4': 1, '5': 9, '9': 0, '10': 'stringValue'}, + {'1': 'bool_value', '3': 4, '4': 1, '5': 8, '9': 0, '10': 'boolValue'}, + { + '1': 'struct_value', + '3': 5, + '4': 1, + '5': 11, + '6': '.google.protobuf.Struct', + '9': 0, + '10': 'structValue' + }, + { + '1': 'list_value', + '3': 6, + '4': 1, + '5': 11, + '6': '.google.protobuf.ListValue', + '9': 0, + '10': 'listValue' + }, + ], + '8': [ + {'1': 'kind'}, + ], +}; + +/// Descriptor for `Value`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List valueDescriptor = $convert.base64Decode( + 'CgVWYWx1ZRI7CgpudWxsX3ZhbHVlGAEgASgOMhouZ29vZ2xlLnByb3RvYnVmLk51bGxWYWx1ZU' + 'gAUgludWxsVmFsdWUSIwoMbnVtYmVyX3ZhbHVlGAIgASgBSABSC251bWJlclZhbHVlEiMKDHN0' + 'cmluZ192YWx1ZRgDIAEoCUgAUgtzdHJpbmdWYWx1ZRIfCgpib29sX3ZhbHVlGAQgASgISABSCW' + 'Jvb2xWYWx1ZRI8CgxzdHJ1Y3RfdmFsdWUYBSABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0' + 'SABSC3N0cnVjdFZhbHVlEjsKCmxpc3RfdmFsdWUYBiABKAsyGi5nb29nbGUucHJvdG9idWYuTG' + 'lzdFZhbHVlSABSCWxpc3RWYWx1ZUIGCgRraW5k'); + +@$core.Deprecated('Use listValueDescriptor instead') +const ListValue$json = { + '1': 'ListValue', + '2': [ + { + '1': 'values', + '3': 1, + '4': 3, + '5': 11, + '6': '.google.protobuf.Value', + '10': 'values' + }, + ], +}; + +/// Descriptor for `ListValue`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List listValueDescriptor = $convert.base64Decode( + 'CglMaXN0VmFsdWUSLgoGdmFsdWVzGAEgAygLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlUgZ2YW' + 'x1ZXM='); diff --git a/protobuf/lib/well_known_types/google/protobuf/timestamp.pb.dart b/protobuf/lib/well_known_types/google/protobuf/timestamp.pb.dart new file mode 100644 index 000000000..0df118ca2 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/timestamp.pb.dart @@ -0,0 +1,198 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/timestamp.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: implementation_imports, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:fixnum/fixnum.dart' as $fixnum; +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; + +/// A Timestamp represents a point in time independent of any time zone or local +/// calendar, encoded as a count of seconds and fractions of seconds at +/// nanosecond resolution. The count is relative to an epoch at UTC midnight on +/// January 1, 1970, in the proleptic Gregorian calendar which extends the +/// Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +/// second table is needed for interpretation, using a [24-hour linear +/// smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +/// restricting to that range, we ensure that we can convert to and from [RFC +/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +/// +/// # Examples +/// +/// Example 1: Compute Timestamp from POSIX `time()`. +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(time(NULL)); +/// timestamp.set_nanos(0); +/// +/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +/// +/// struct timeval tv; +/// gettimeofday(&tv, NULL); +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(tv.tv_sec); +/// timestamp.set_nanos(tv.tv_usec * 1000); +/// +/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +/// +/// FILETIME ft; +/// GetSystemTimeAsFileTime(&ft); +/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +/// +/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +/// Timestamp timestamp; +/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +/// +/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +/// +/// long millis = System.currentTimeMillis(); +/// +/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +/// .setNanos((int) ((millis % 1000) * 1000000)).build(); +/// +/// Example 5: Compute Timestamp from Java `Instant.now()`. +/// +/// Instant now = Instant.now(); +/// +/// Timestamp timestamp = +/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +/// .setNanos(now.getNano()).build(); +/// +/// Example 6: Compute Timestamp from current time in Python. +/// +/// timestamp = Timestamp() +/// timestamp.GetCurrentTime() +/// +/// # JSON Mapping +/// +/// In JSON format, the Timestamp type is encoded as a string in the +/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +/// where {year} is always expressed using four digits while {month}, {day}, +/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +/// is required. A ProtoJSON serializer should always use UTC (as indicated by +/// "Z") when printing the Timestamp type and a ProtoJSON parser should be +/// able to accept both UTC and other timezones (as indicated by an offset). +/// +/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +/// 01:30 UTC on January 15, 2017. +/// +/// In JavaScript, one can convert a Date object to this format using the +/// standard +/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) +/// method. In Python, a standard `datetime.datetime` object can be converted +/// to this format using +/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +/// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() +/// ) to obtain a formatter capable of generating timestamps in this format. +class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { + factory Timestamp({ + $fixnum.Int64? seconds, + $core.int? nanos, + }) { + final result = create(); + if (seconds != null) result.seconds = seconds; + if (nanos != null) result.nanos = nanos; + return result; + } + + Timestamp._(); + + factory Timestamp.fromBuffer($core.List<$core.int> data, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(data, registry); + factory Timestamp.fromJson($core.String json, + [$pb.ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(json, registry); + + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + _omitMessageNames ? '' : 'Timestamp', + package: + const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'), + createEmptyInstance: create, + wellKnownType: $mixin.WellKnownType.timestamp) + ..aInt64(1, _omitFieldNames ? '' : 'seconds') + ..aI(2, _omitFieldNames ? '' : 'nanos') + ..hasRequiredFields = false; + + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Timestamp clone() => deepCopy(); + @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') + Timestamp copyWith(void Function(Timestamp) updates) => + super.copyWith((message) => updates(message as Timestamp)) as Timestamp; + + @$core.override + $pb.BuilderInfo get info_ => _i; + + @$core.pragma('dart2js:noInline') + static Timestamp create() => Timestamp._(); + @$core.override + Timestamp createEmptyInstance() => create(); + @$core.pragma('dart2js:noInline') + static Timestamp getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static Timestamp? _defaultInstance; + + /// Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + /// be between -62135596800 and 253402300799 inclusive (which corresponds to + /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). + @$pb.TagNumber(1) + $fixnum.Int64 get seconds => $_getI64(0); + @$pb.TagNumber(1) + set seconds($fixnum.Int64 value) => $_setInt64(0, value); + @$pb.TagNumber(1) + $core.bool hasSeconds() => $_has(0); + @$pb.TagNumber(1) + void clearSeconds() => $_clearField(1); + + /// Non-negative fractions of a second at nanosecond resolution. This field is + /// the nanosecond portion of the duration, not an alternative to seconds. + /// Negative second values with fractions must still have non-negative nanos + /// values that count forward in time. Must be between 0 and 999,999,999 + /// inclusive. + @$pb.TagNumber(2) + $core.int get nanos => $_getIZ(1); + @$pb.TagNumber(2) + set nanos($core.int value) => $_setSignedInt32(1, value); + @$pb.TagNumber(2) + $core.bool hasNanos() => $_has(1); + @$pb.TagNumber(2) + void clearNanos() => $_clearField(2); + + /// Creates a new instance from [dateTime]. + /// + /// Time zone information will not be preserved. + static Timestamp fromDateTime($core.DateTime dateTime) { + final result = create(); + $mixin.TimestampMixin.setFromDateTime(result, dateTime); + return result; + } +} + +const $core.bool _omitFieldNames = + $core.bool.fromEnvironment('protobuf.omit_field_names'); +const $core.bool _omitMessageNames = + $core.bool.fromEnvironment('protobuf.omit_message_names'); diff --git a/protobuf/lib/well_known_types/google/protobuf/timestamp.pbjson.dart b/protobuf/lib/well_known_types/google/protobuf/timestamp.pbjson.dart new file mode 100644 index 000000000..739dd55a2 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/timestamp.pbjson.dart @@ -0,0 +1,30 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/timestamp.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports +// ignore_for_file: unused_import + +import 'dart:convert' as $convert; +import 'dart:core' as $core; +import 'dart:typed_data' as $typed_data; + +@$core.Deprecated('Use timestampDescriptor instead') +const Timestamp$json = { + '1': 'Timestamp', + '2': [ + {'1': 'seconds', '3': 1, '4': 1, '5': 3, '10': 'seconds'}, + {'1': 'nanos', '3': 2, '4': 1, '5': 5, '10': 'nanos'}, + ], +}; + +/// Descriptor for `Timestamp`. Decode as a `google.protobuf.DescriptorProto`. +final $typed_data.Uint8List timestampDescriptor = $convert.base64Decode( + 'CglUaW1lc3RhbXASGAoHc2Vjb25kcxgBIAEoA1IHc2Vjb25kcxIUCgVuYW5vcxgCIAEoBVIFbm' + 'Fub3M='); diff --git a/protobuf/lib/well_known_types/google/protobuf/type.pb.dart b/protobuf/lib/well_known_types/google/protobuf/type.pb.dart new file mode 100644 index 000000000..020580e62 --- /dev/null +++ b/protobuf/lib/well_known_types/google/protobuf/type.pb.dart @@ -0,0 +1,612 @@ +// This is a generated file - do not edit. +// +// Generated from google/protobuf/type.proto. + +// @dart = 3.3 + +// ignore_for_file: annotate_overrides, camel_case_types, comment_references +// ignore_for_file: constant_identifier_names +// ignore_for_file: curly_braces_in_flow_control_structures +// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes +// ignore_for_file: non_constant_identifier_names, prefer_relative_imports + +import 'dart:core' as $core; + +import 'package:protobuf/protobuf.dart' as $pb; +import 'package:protobuf/well_known_types/google/protobuf/any.pb.dart' as $1; +import 'package:protobuf/well_known_types/google/protobuf/source_context.pb.dart' + as $0; +import 'package:protobuf/well_known_types/google/protobuf/type.pbenum.dart'; + +export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions; +export 'package:protobuf/well_known_types/google/protobuf/type.pbenum.dart'; + +/// A protocol buffer message type. +/// +/// New usages of this message as an alternative to DescriptorProto are strongly +/// discouraged. This message does not reliability preserve all information +/// necessary to model the schema and preserve semantics. Instead make use of +/// FileDescriptorSet which preserves the necessary information. +class Type extends $pb.GeneratedMessage { + factory Type({ + $core.String? name, + $core.Iterable? fields, + $core.Iterable<$core.String>? oneofs, + $core.Iterable