Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: test/protos/dart_options.proto

Issue 2103743002: Rename mixin protos and add a check for undefined mixin name (Closed) Base URL: git@github.com:dart-lang/dart-protoc-plugin.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Experimental options controlling Dart code generation. 1 // Experimental options controlling Dart code generation.
2 syntax = "proto2"; 2 syntax = "proto2";
3 3
4 package dart_options; 4 package dart_options;
5 5
6 // This file must be modified for google internal use, 6 // This file must be modified for Google internal use,
7 // because custom options only work when the package name 7 // because custom options only work when the package name
8 // agrees with the version of protoc we are using. 8 // agrees with the version of protoc we are using.
9 // (The import statement and "google.protobuf." prefix need to be changed.) 9 // (The import statement and "google.protobuf." prefix need to be changed.)
10 10
11 import "descriptor_2_5_opensource.proto"; 11 import "descriptor_2_5_opensource.proto";
12 12
13 // A mixin to be applied in the 'with' clause of a generated proto in dart. 13 // A mixin that can be used in the 'with' clause of the generated Dart class
14 // for a proto message.
14 message DartMixin { 15 message DartMixin {
15 // Class name of the mixin class. 16 // The name of the mixin class.
16 optional string name = 1; 17 optional string name = 1;
17 18
18 // File from which the mixin class is imported. 19 // A URI pointing to the Dart library that defines the mixin.
19 // The generated Dart code will use this in an import statement. 20 // The generated Dart code will use this in an import statement.
20 optional string import_from = 2; 21 optional string import_from = 2;
21 22
22 // Used to apply multiple mixins to a proto. 23 // The name of another mixin to be applied ahead of this one.
23 // The mixin listed in parent will always be applied before this one, 24 // The generated class for the message will inherit from all mixins
24 // making the generated proto implement both mixins. 25 // in the parent chain.
25 optional string parent = 3; 26 optional string parent = 3;
26 } 27 }
27 28
28 // Defines mixins imported from dart files to be used on messages in this file. 29 // Defines additional Dart imports to be used with messages in this file.
29 message ImportedMixins { 30 message Imports {
30 31
31 // The DartMixins to be imported. 32 // Mixins to be used on messages in this file.
33 // These mixins are in addition to internally defined mixins (e.g PbMapMixin)
34 // and may override them.
35 //
36 // Warning: mixins are experimental. The protoc Dart plugin doesn't check
37 // for name conflicts between mixin class members and generated class members,
38 // so the generated code may contain errors. Therefore, running dartanalyzer
39 // on the generated file is a good idea.
32 repeated DartMixin mixins = 1; 40 repeated DartMixin mixins = 1;
33 } 41 }
34 42
35 extend google.protobuf.FileOptions { 43 extend google.protobuf.FileOptions {
36 44
37 // Defines the named mixins to be used on messages in this file. 45 optional Imports imports = 28125061;
38 // These mixins are in addition to internally defined mixins (e.g PbMapMixin)
39 // and may override them.
40 // Warning: there is no checking at compile time for name conflicts between
41 // identifiers defined in the mixin and proto-generated identifiers.
42 // Running dartanalyzer on the generated file might find some of them.
43 optional ImportedMixins imported_mixins = 28125061;
44 46
45 // Applies the named mixin to all messages in this file. 47 // Applies the named mixin to all messages in this file.
46 // (May be overridden by the "mixin" option on a message.) 48 // (May be overridden by the "mixin" option on a message.)
47 // For now, "PbMapMixin" is the only available mixin. 49 // For now, "PbMapMixin" is the only available mixin.
48 optional string default_mixin = 96128839; 50 optional string default_mixin = 96128839;
49 } 51 }
50 52
51 extend google.protobuf.MessageOptions { 53 extend google.protobuf.MessageOptions {
52 54
53 // Applies the named mixin. 55 // Applies the named mixin.
54 // For now, "PbMapMixin" is the only available mixin. 56 // For now, "PbMapMixin" is the only available mixin.
55 // The empty string can be used to turn off mixins for this message. 57 // The empty string can be used to turn off mixins for this message.
56 optional string mixin = 96128839; 58 optional string mixin = 96128839;
57 } 59 }
58 60
59 extend google.protobuf.FieldOptions { 61 extend google.protobuf.FieldOptions {
60 62
61 // Uses the given name for getters, setters and as suffixes for has/clear 63 // Uses the given name for getters, setters and as suffixes for has/clear
62 // methods in the generated Dart file. Should be lowerCamelCase. 64 // methods in the generated Dart file. Should be lowerCamelCase.
63 optional string dart_name = 28700919; 65 optional string dart_name = 28700919;
64 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698