Skip to content

Commit 68ea1f4

Browse files
hiepthain0v1
authored andcommitted
grpc-loader: update & correct interface types
1 parent ae33e87 commit 68ea1f4

File tree

3 files changed

+42
-14
lines changed

3 files changed

+42
-14
lines changed

packages/proto-loader/src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,18 @@ export enum IdempotencyLevel {
122122
}
123123

124124
export interface NamePart {
125-
namePart: string;
126-
isExtension: boolean;
125+
name_part: string;
126+
is_extension: boolean;
127127
}
128128

129129
export interface UninterpretedOption {
130130
name?: (NamePart[]|null);
131-
identifierValue?: (string|null);
132-
positiveIntValue?: (number|Long|string|null);
133-
negativeIntValue?: (number|Long|string|null);
134-
doubleValue?: (number|null);
135-
stringValue?: (Uint8Array|string|null);
136-
aggregateValue?: (string|null);
131+
identifier_value?: (string|null);
132+
positive_int_value?: (number|null);
133+
negative_int_value?: (number|null);
134+
double_value?: (number|null);
135+
string_value?: (string|null);
136+
aggregate_value?: (string|null);
137137
}
138138

139139
export interface CustomHttpPattern {
@@ -150,8 +150,8 @@ export interface HttpRule {
150150
patch?: (string|null);
151151
custom?: (CustomHttpPattern|null);
152152
body?: (string|null);
153-
responseBody?: (string|null);
154-
additionalBindings?: (HttpRule[]|null);
153+
response_body?: (string|null);
154+
additional_bindings?: (HttpRule[]|null);
155155
}
156156

157157
export interface MethodOptions {

packages/proto-loader/test/descriptor_type_test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,24 @@ describe('Descriptor types', () => {
140140
assert.deepStrictEqual(service.Hello.options, {
141141
deprecated: true,
142142
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
143-
uninterpreted_option: { identifier_value: 'foo' },
144-
'(google.api.http)': { post: '/hello' },
143+
uninterpreted_option: {
144+
name: {
145+
name_part: 'foo',
146+
is_extension: false,
147+
},
148+
identifier_value: 'bar',
149+
positive_int_value: 9007199254740991,
150+
negative_int_value: -9007199254740991,
151+
double_value: 1.2345,
152+
string_value: 'foobar',
153+
aggregate_value: 'foobar'
154+
},
155+
'(google.api.http)': {
156+
post: "/hello",
157+
body: "*",
158+
response_body: "*",
159+
additional_bindings: {}
160+
},
145161
'(google.api.method_signature)': 'bar'
146162
})
147163
})

packages/proto-loader/test_protos/method_options.proto

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,30 @@ import "google/api/httpbody.proto";
77
message Empty {}
88

99
message MethodSignature {
10-
repeated string method_signature = 0;
10+
repeated string method_signature = 1;
1111
}
1212

1313
service Hello {
1414
rpc Hello (Empty) returns (Empty) {
1515
option deprecated = true;
1616
option idempotency_level = IDEMPOTENCY_UNKNOWN;
1717
option uninterpreted_option = {
18-
identifier_value: 'foo'
18+
name: {
19+
name_part: 'foo'
20+
is_extension: false
21+
}
22+
identifier_value: 'bar'
23+
positive_int_value: 9007199254740991
24+
negative_int_value: -9007199254740991
25+
double_value: 1.2345
26+
string_value: 'foobar'
27+
aggregate_value: 'foobar'
1928
};
2029
option (google.api.http) = {
2130
post: "/hello"
31+
body: "*"
32+
response_body: "*"
33+
additional_bindings: {}
2234
};
2335
option (google.api.method_signature) = 'bar';
2436
}

0 commit comments

Comments
 (0)