Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 1484a09

Browse files
authored
Whittling down config_v2 (#2666)
1 parent 1f1f16e commit 1484a09

File tree

2 files changed

+11
-158
lines changed

2 files changed

+11
-158
lines changed

src/main/proto/com/google/api/codegen/config.proto

+4-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ message ConfigProto {
100100

101101
// A required field to specify the version of GAPIC config schema.
102102
// It is versioned using Semantic Versioning 2.0.0 (semver) and follows the
103-
// semver specification. Currently, the only valid value is "1.0.0".
103+
// semver specification. Currently, the only valid value is "1.0.0" and "2.0.0"
104+
// Those following "2.0.0" should also follow the config_v2.proto schema.
104105
string config_schema_version = 21;
105106
}
106107

@@ -362,7 +363,7 @@ message SampleInitAttribute {
362363
// should be accepted as a parameter, with the given name, to the sample function.
363364
string sample_argument_name = 2;
364365

365-
// If `read_file` is true, then during sample initialization, the value of this
366+
// If `read_file` is true, then during sample initialization, the value of this
366367
// attribute gets replaced by the contents of the local file with the given name.
367368
// This is only allowed when this parameter is a bytes field.
368369
// If this parameter is required or optional, the original value of this parameter
@@ -699,7 +700,7 @@ message OutputSpec {
699700
repeated OutputSpec body = 3;
700701

701702
// The map over which to iterate.
702-
// Exactly one of `map` and `collection` should be specified.
703+
// Exactly one of `map` and `collection` should be specified.
703704
string map = 4;
704705

705706
// The iteration variable for key.

src/main/proto/com/google/api/codegen/v2/config_v2.proto

+7-155
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,11 @@ option java_multiple_files = true;
88
option java_outer_classname = "ConfigProtoDesc";
99
option java_package = "com.google.api.codegen.v2";
1010

11-
// `ConfigProto` specifies the configuration of code generation for
12-
// GAPIC. The user provides it via a YAML file; this message here
13-
// represents the schema for this file.
14-
//
15-
// Example of a YAML configuration:
16-
//
17-
// type: com.google.api.codegen.ConfigProto
18-
// generator:
19-
// id: java
20-
// interfaces:
21-
// - name: google.example.library.v1.LibraryService
22-
// collections:
23-
// - name_pattern: shelves/{shelf}
24-
// entity_name: shelf
25-
// - name_pattern: shelves/{shelf}/books/{book}
26-
// entity_name: book
27-
// ...
28-
// retry_codes_def:
29-
// - name: idempotent
30-
// retry_codes:
31-
// ...
32-
// - name: non_idempotent
33-
// retry_codes:
34-
// retry_params_def:
35-
// - name: default
36-
// ...
37-
// methods:
38-
// - name: PublishBooks
39-
// flattening:
40-
// groups:
41-
// - parameters:
42-
// - name
43-
// - parameters:
44-
// - name
45-
// - version
46-
// page_streaming:
47-
// request:
48-
// token_field: page_token
49-
// response:
50-
// token_field: next_page_token
51-
// resources_field: books
52-
// batching:
53-
// thresholds:
54-
// element_count_threshold: 5
55-
// request_byte_threshold: 16384
56-
// batch_descriptor:
57-
// batched_field: pictures
58-
// request_discriminator_fields:
59-
// - album
60-
// - labels
61-
// subresponse_field: pic_id
62-
// retry_codes_name: idempotent
63-
// retry_params_name: default
64-
// field_name_patterns:
65-
// name: book
66-
// - name: GetBook
67-
// ...
68-
// ...
6911
message ConfigProto {
7012
// The settings of generated code in a specific language.
7113
map<string, LanguageSettingsProto> language_settings = 4;
7214

73-
// The language of the generated code.
74-
string language = 5; // UNSUPPORTED.
15+
reserved 5, 20;
7516

7617
// The configuration for the license header to put on generated files.
7718
LicenseHeaderProto license_header = 7;
@@ -96,12 +37,9 @@ message ConfigProto {
9637
// [DEPRECATED]
9738
.google.protobuf.BoolValue enable_string_format_functions_override = 22;
9839

99-
// A list of message resource name configurations.
100-
repeated ResourceNameMessageConfigProto resource_name_generation = 20;
101-
10240
// A required field to specify the version of GAPIC config schema.
10341
// It is versioned using Semantic Versioning 2.0.0 (semver) and follows the
104-
// semver specification. Currently, the only valid value is "1.0.0".
42+
// semver specification. Currently, the only valid value is "2.0.0".
10543
string config_schema_version = 21;
10644
}
10745

@@ -140,8 +78,7 @@ enum ReleaseLevel {
14078
}
14179

14280
message LicenseHeaderProto {
143-
// The file containing the copyright line(s).
144-
string copyright_file = 1; // DEPRECATED. The Google copyright will always be used.
81+
reserved 1;
14582

14683
// The file containing the raw license header without any copyright line(s).
14784
string license_file = 2;
@@ -187,14 +124,7 @@ message SmokeTestConfigProto {
187124
}
188125

189126
message CollectionConfigProto {
190-
// A pattern to describe the names of the resources of this
191-
// collection, using the platform's conventions for URI patterns. A
192-
// generator may use this to generate methods to compose and
193-
// decompose such names. The pattern should use named placeholders
194-
// as in `shelves/{shelf}/books/{book}`; those will be taken as
195-
// hints for the parameter names of the generated methods. If
196-
// empty, no name methods are generated.
197-
string name_pattern = 1;
127+
reserved 1;
198128

199129
// Name to be used as a basis for generated methods and classes.
200130
string entity_name = 2;
@@ -235,11 +165,7 @@ message MethodConfigProto {
235165
// The fully qualified name of the method.
236166
string name = 1;
237167

238-
// Specifies the configuration for parameter flattening.
239-
FlatteningConfigProto flattening = 2;
240-
241-
// Specifies the configuration for paging.
242-
PageStreamingConfigProto page_streaming = 3;
168+
reserved 2, 3, 7, 8, 9, 11, 14, 15;
243169

244170
// Specifies the configuration for gRPC-streaming responses.
245171
// Note that this is for configuring paged gRPC-streaming responses.
@@ -254,22 +180,9 @@ message MethodConfigProto {
254180
// The name must be defined in InterfaceConfigProto::retry_params_def.
255181
string retry_params_name = 5;
256182

257-
// Specifies the default timeout for a non-retrying call. If the call is
258-
// retrying, refer to `retry_params_name` instead.
259-
uint64 timeout_millis = 11; // UNSUPPORTED.
260-
261183
// Specifies the configuration for batching.
262184
BatchingConfigProto batching = 6;
263185

264-
reserved 7;
265-
266-
// Fields that are always required for a request to be valid.
267-
repeated string required_fields = 8;
268-
269-
// Maps the field name of the request type to entity_name of CollectionConfigProto.
270-
// It is used to specify the string pattern that the field must follow.
271-
map<string, string> field_name_patterns = 9;
272-
273186
// Specifies complex structure fields that need to be initialized by the sample code for
274187
// the sample to be usable.
275188
repeated string sample_code_init_fields = 10;
@@ -296,17 +209,8 @@ message MethodConfigProto {
296209
// IAM methods to IamPolicy for Pub/Sub.
297210
string reroute_to_grpc_interface = 12;
298211

299-
// TODO: Remove this config once there are no use cases.
300-
// Specifies the list of the method's input message fields (including nested
301-
// ones, using the dot notation), which should be url-encoded in
302-
// "x-goog-request-params" header
303-
repeated string header_request_params = 14; // UNSUPPORTED.
304-
305212
repeated SurfaceTreatmentProto surface_treatments = 20;
306213

307-
// Set the resource name treatment for fields
308-
ResourceNameTreatment resource_name_treatment = 15;
309-
310214
// Long-running settings.
311215
LongRunningConfigProto long_running = 30;
312216

@@ -461,30 +365,6 @@ message SampleConfiguration {
461365
repeated SampleTypeConfiguration api_explorer = 3;
462366
}
463367

464-
// `FlatteningConfigProto` describes the parameter groups for which a
465-
// generator should produce method overloads which allow a client to
466-
// directly pass request message fields as method parameters. This
467-
// information may or may not be used, depending on the target
468-
// language.
469-
message FlatteningConfigProto {
470-
// Specifies a list of flattening groups.
471-
repeated FlatteningGroupProto groups = 1;
472-
}
473-
474-
// `FlatteningGroupProto` represents a list of parameters to be flattened.
475-
message FlatteningGroupProto {
476-
// The list of parameters to include in this flattening group. Each
477-
// parameter must be a field of the request message.
478-
repeated string parameters = 1;
479-
480-
string flattening_group_name = 2; // DEPRECATED.
481-
482-
// Map flattening parameters listed in parameters field to a resource name
483-
// treatment. This is used to override the resource_name_treament setting in
484-
// MethodConfigProto.
485-
map<string, ResourceNameTreatment> parameter_resource_name_treatment = 3;
486-
}
487-
488368
// The ResourceNameTreatment enum can be used to specify how to treat the
489369
// resource name formats defined in the field_name_patterns
490370
// and response_field_name_patterns fields.
@@ -505,24 +385,12 @@ enum ResourceNameTreatment {
505385
// `PageStreamingConfigProto` describes information for generating a method which
506386
// transforms a paging list rpc into a stream of resources.
507387
message PageStreamingConfigProto {
508-
// Specifies request information of the list method.
509-
PageStreamingRequestProto request = 1;
388+
reserved 1;
510389

511390
// Specifies response information of the list method.
512391
PageStreamingResponseProto response = 2;
513392
}
514393

515-
// `PageStreamingRequestProto` defines which fields match the paging pattern in
516-
// the request.
517-
message PageStreamingRequestProto {
518-
// The name of the field in the request containing the page token.
519-
string token_field = 1;
520-
521-
// Optional. The name of the field, if present, specifying the maximum number
522-
// of elements to be returned in the response.
523-
string page_size_field = 2;
524-
}
525-
526394
// `PageStreamingResponseProto` defines which fields match the paging pattern in
527395
// the response.
528396
message PageStreamingResponseProto {
@@ -623,17 +491,6 @@ message BatchingDescriptorProto {
623491
string subresponse_field = 3;
624492
}
625493

626-
// `ResourceNameMessageConfigProto` specifies the fields of a message that
627-
// support a resource name type.
628-
message ResourceNameMessageConfigProto {
629-
// The simple name of the message.
630-
string message_name = 1;
631-
632-
// A list of field simple names and corresponding entity names, as defined in
633-
// the collection configs.
634-
map<string, string> field_entity_map = 2;
635-
}
636-
637494
// SurfaceTreatmentProto describes treatments to the code generation
638495
// that are expected to be different for each language.
639496
message SurfaceTreatmentProto {
@@ -658,12 +515,7 @@ enum VisibilityProto {
658515
// LongRunningProto describes settings to use when generating API methods
659516
// that use the long-running operation pattern.
660517
message LongRunningConfigProto {
661-
// The fully-qualified type that is returned from an Operation when it is
662-
// complete.
663-
string return_type = 1;
664-
665-
// The fully-qualified type of the metadata of an Operation.
666-
string metadata_type = 2;
518+
reserved 1, 2;
667519

668520
// Whether or not the server implements delete.
669521
bool implements_delete = 3;

0 commit comments

Comments
 (0)