Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit a67ffa7

Browse files
yoshi-automationcallmehiphop
authored andcommitted
feat: add plural and singular resource descriptor (#78)
1 parent 97d7180 commit a67ffa7

File tree

4 files changed

+152
-6
lines changed

4 files changed

+152
-6
lines changed

protos/protos.d.ts

+30
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import * as Long from "long";
116
import * as $protobuf from "protobufjs";
217
/** Namespace google. */
318
export namespace google {
@@ -1083,6 +1098,12 @@ export namespace google {
10831098

10841099
/** ResourceDescriptor history */
10851100
history?: (google.api.ResourceDescriptor.History|null);
1101+
1102+
/** ResourceDescriptor plural */
1103+
plural?: (string|null);
1104+
1105+
/** ResourceDescriptor singular */
1106+
singular?: (string|null);
10861107
}
10871108

10881109
/** Represents a ResourceDescriptor. */
@@ -1106,6 +1127,12 @@ export namespace google {
11061127
/** ResourceDescriptor history. */
11071128
public history: google.api.ResourceDescriptor.History;
11081129

1130+
/** ResourceDescriptor plural. */
1131+
public plural: string;
1132+
1133+
/** ResourceDescriptor singular. */
1134+
public singular: string;
1135+
11091136
/**
11101137
* Creates a new ResourceDescriptor instance using the specified properties.
11111138
* @param [properties] Properties to set
@@ -2842,6 +2869,9 @@ export namespace google {
28422869

28432870
/** FileOptions uninterpretedOption */
28442871
uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null);
2872+
2873+
/** FileOptions .google.api.resourceDefinition */
2874+
".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null);
28452875
}
28462876

28472877
/** Represents a FileOptions. */

protos/protos.js

+103-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
216
(function(global, factory) { /* global define, require, module */
317

@@ -2647,6 +2661,8 @@
26472661
* @property {Array.<string>|null} [pattern] ResourceDescriptor pattern
26482662
* @property {string|null} [nameField] ResourceDescriptor nameField
26492663
* @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history
2664+
* @property {string|null} [plural] ResourceDescriptor plural
2665+
* @property {string|null} [singular] ResourceDescriptor singular
26502666
*/
26512667

26522668
/**
@@ -2697,6 +2713,22 @@
26972713
*/
26982714
ResourceDescriptor.prototype.history = 0;
26992715

2716+
/**
2717+
* ResourceDescriptor plural.
2718+
* @member {string} plural
2719+
* @memberof google.api.ResourceDescriptor
2720+
* @instance
2721+
*/
2722+
ResourceDescriptor.prototype.plural = "";
2723+
2724+
/**
2725+
* ResourceDescriptor singular.
2726+
* @member {string} singular
2727+
* @memberof google.api.ResourceDescriptor
2728+
* @instance
2729+
*/
2730+
ResourceDescriptor.prototype.singular = "";
2731+
27002732
/**
27012733
* Creates a new ResourceDescriptor instance using the specified properties.
27022734
* @function create
@@ -2730,6 +2762,10 @@
27302762
writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField);
27312763
if (message.history != null && message.hasOwnProperty("history"))
27322764
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history);
2765+
if (message.plural != null && message.hasOwnProperty("plural"))
2766+
writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural);
2767+
if (message.singular != null && message.hasOwnProperty("singular"))
2768+
writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular);
27332769
return writer;
27342770
};
27352771

@@ -2778,6 +2814,12 @@
27782814
case 4:
27792815
message.history = reader.int32();
27802816
break;
2817+
case 5:
2818+
message.plural = reader.string();
2819+
break;
2820+
case 6:
2821+
message.singular = reader.string();
2822+
break;
27812823
default:
27822824
reader.skipType(tag & 7);
27832825
break;
@@ -2835,6 +2877,12 @@
28352877
case 2:
28362878
break;
28372879
}
2880+
if (message.plural != null && message.hasOwnProperty("plural"))
2881+
if (!$util.isString(message.plural))
2882+
return "plural: string expected";
2883+
if (message.singular != null && message.hasOwnProperty("singular"))
2884+
if (!$util.isString(message.singular))
2885+
return "singular: string expected";
28382886
return null;
28392887
};
28402888

@@ -2875,6 +2923,10 @@
28752923
message.history = 2;
28762924
break;
28772925
}
2926+
if (object.plural != null)
2927+
message.plural = String(object.plural);
2928+
if (object.singular != null)
2929+
message.singular = String(object.singular);
28782930
return message;
28792931
};
28802932

@@ -2897,6 +2949,8 @@
28972949
object.type = "";
28982950
object.nameField = "";
28992951
object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0;
2952+
object.plural = "";
2953+
object.singular = "";
29002954
}
29012955
if (message.type != null && message.hasOwnProperty("type"))
29022956
object.type = message.type;
@@ -2909,6 +2963,10 @@
29092963
object.nameField = message.nameField;
29102964
if (message.history != null && message.hasOwnProperty("history"))
29112965
object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] : message.history;
2966+
if (message.plural != null && message.hasOwnProperty("plural"))
2967+
object.plural = message.plural;
2968+
if (message.singular != null && message.hasOwnProperty("singular"))
2969+
object.singular = message.singular;
29122970
return object;
29132971
};
29142972

@@ -7323,6 +7381,7 @@
73237381
* @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace
73247382
* @property {string|null} [rubyPackage] FileOptions rubyPackage
73257383
* @property {Array.<google.protobuf.IUninterpretedOption>|null} [uninterpretedOption] FileOptions uninterpretedOption
7384+
* @property {Array.<google.api.IResourceDescriptor>|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition
73267385
*/
73277386

73287387
/**
@@ -7335,6 +7394,7 @@
73357394
*/
73367395
function FileOptions(properties) {
73377396
this.uninterpretedOption = [];
7397+
this[".google.api.resourceDefinition"] = [];
73387398
if (properties)
73397399
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
73407400
if (properties[keys[i]] != null)
@@ -7509,6 +7569,14 @@
75097569
*/
75107570
FileOptions.prototype.uninterpretedOption = $util.emptyArray;
75117571

7572+
/**
7573+
* FileOptions .google.api.resourceDefinition.
7574+
* @member {Array.<google.api.IResourceDescriptor>} .google.api.resourceDefinition
7575+
* @memberof google.protobuf.FileOptions
7576+
* @instance
7577+
*/
7578+
FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray;
7579+
75127580
/**
75137581
* Creates a new FileOptions instance using the specified properties.
75147582
* @function create
@@ -7576,6 +7644,9 @@
75767644
if (message.uninterpretedOption != null && message.uninterpretedOption.length)
75777645
for (var i = 0; i < message.uninterpretedOption.length; ++i)
75787646
$root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim();
7647+
if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length)
7648+
for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i)
7649+
$root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim();
75797650
return writer;
75807651
};
75817652

@@ -7675,6 +7746,11 @@
76757746
message.uninterpretedOption = [];
76767747
message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32()));
76777748
break;
7749+
case 1053:
7750+
if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length))
7751+
message[".google.api.resourceDefinition"] = [];
7752+
message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32()));
7753+
break;
76787754
default:
76797755
reader.skipType(tag & 7);
76807756
break;
@@ -7785,6 +7861,15 @@
77857861
return "uninterpretedOption." + error;
77867862
}
77877863
}
7864+
if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) {
7865+
if (!Array.isArray(message[".google.api.resourceDefinition"]))
7866+
return ".google.api.resourceDefinition: array expected";
7867+
for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) {
7868+
var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]);
7869+
if (error)
7870+
return ".google.api.resourceDefinition." + error;
7871+
}
7872+
}
77887873
return null;
77897874
};
77907875

@@ -7862,6 +7947,16 @@
78627947
message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]);
78637948
}
78647949
}
7950+
if (object[".google.api.resourceDefinition"]) {
7951+
if (!Array.isArray(object[".google.api.resourceDefinition"]))
7952+
throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected");
7953+
message[".google.api.resourceDefinition"] = [];
7954+
for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) {
7955+
if (typeof object[".google.api.resourceDefinition"][i] !== "object")
7956+
throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected");
7957+
message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]);
7958+
}
7959+
}
78657960
return message;
78667961
};
78677962

@@ -7878,8 +7973,10 @@
78787973
if (!options)
78797974
options = {};
78807975
var object = {};
7881-
if (options.arrays || options.defaults)
7976+
if (options.arrays || options.defaults) {
78827977
object.uninterpretedOption = [];
7978+
object[".google.api.resourceDefinition"] = [];
7979+
}
78837980
if (options.defaults) {
78847981
object.javaPackage = "";
78857982
object.javaOuterClassname = "";
@@ -7947,6 +8044,11 @@
79478044
for (var j = 0; j < message.uninterpretedOption.length; ++j)
79488045
object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options);
79498046
}
8047+
if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) {
8048+
object[".google.api.resourceDefinition"] = [];
8049+
for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j)
8050+
object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options);
8051+
}
79508052
return object;
79518053
};
79528054

protos/protos.json

+14
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@
341341
"id": 1055,
342342
"extend": "google.protobuf.FieldOptions"
343343
},
344+
"resourceDefinition": {
345+
"rule": "repeated",
346+
"type": "google.api.ResourceDescriptor",
347+
"id": 1053,
348+
"extend": "google.protobuf.FileOptions"
349+
},
344350
"resource": {
345351
"type": "google.api.ResourceDescriptor",
346352
"id": 1053,
@@ -364,6 +370,14 @@
364370
"history": {
365371
"type": "History",
366372
"id": 4
373+
},
374+
"plural": {
375+
"type": "string",
376+
"id": 5
377+
},
378+
"singular": {
379+
"type": "string",
380+
"id": 6
367381
}
368382
},
369383
"nested": {

synth.metadata

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"updateTime": "2019-11-14T03:52:09.794198Z",
2+
"updateTime": "2019-11-19T12:24:42.593913Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.41.1",
8-
"dockerImage": "googleapis/artman@sha256:545c758c76c3f779037aa259023ec3d1ef2d57d2c8cd00a222cb187d63ceac5e"
7+
"version": "0.42.1",
8+
"dockerImage": "googleapis/artman@sha256:c773192618c608a7a0415dd95282f841f8e6bcdef7dd760a988c93b77a64bd57"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "218164b3deba1075979c9dca5f71461379e42dd1",
16-
"internalRef": "280279014"
15+
"sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a",
16+
"internalRef": "281088257"
1717
}
1818
},
1919
{

0 commit comments

Comments
 (0)