Skip to content

Commit 1e37caa

Browse files
committed
add test case for partially set options
1 parent 27d6087 commit 1e37caa

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

packages/proto-loader/test/descriptor_type_test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('Descriptor types', () => {
139139
const service = packageDefinition.Hello as proto_loader.ServiceDefinition
140140
assert.deepStrictEqual(service.Hello.options, {
141141
deprecated: true,
142-
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
142+
idempotency_level: 'NO_SIDE_EFFECTS',
143143
uninterpreted_option: {
144144
name: {
145145
name_part: 'foo',
@@ -165,5 +165,17 @@ describe('Descriptor types', () => {
165165
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
166166
uninterpreted_option: []
167167
})
168+
assert.deepStrictEqual(service.HelloWithSomeOptions.options, {
169+
deprecated: true,
170+
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
171+
uninterpreted_option: [],
172+
'(google.api.http)': {
173+
get: "/hello",
174+
additional_bindings: {
175+
body: '*',
176+
get: '/hello-world'
177+
}
178+
},
179+
})
168180
})
169181
});

packages/proto-loader/test_protos/method_options.proto

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ message MethodSignature {
1313
service Hello {
1414
rpc Hello (Empty) returns (Empty) {
1515
option deprecated = true;
16-
option idempotency_level = IDEMPOTENCY_UNKNOWN;
16+
option idempotency_level = NO_SIDE_EFFECTS;
1717
option uninterpreted_option = {
1818
name: {
1919
name_part: 'foo'
@@ -35,4 +35,14 @@ service Hello {
3535
option (google.api.method_signature) = 'bar';
3636
}
3737
rpc HelloWithoutOptions (Empty) returns (Empty) {}
38+
rpc HelloWithSomeOptions (Empty) returns (Empty) {
39+
option deprecated = true;
40+
option (google.api.http) = {
41+
get: "/hello"
42+
additional_bindings: {
43+
get: "/hello-world"
44+
body: "*"
45+
}
46+
};
47+
}
3848
}

0 commit comments

Comments
 (0)