add test case for partially set options

This commit is contained in:
Christopher Fenn 2024-04-05 16:37:03 +02:00
parent 27d608763b
commit 1e37caadfc
2 changed files with 24 additions and 2 deletions

View File

@ -139,7 +139,7 @@ describe('Descriptor types', () => {
const service = packageDefinition.Hello as proto_loader.ServiceDefinition
assert.deepStrictEqual(service.Hello.options, {
deprecated: true,
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
idempotency_level: 'NO_SIDE_EFFECTS',
uninterpreted_option: {
name: {
name_part: 'foo',
@ -165,5 +165,17 @@ describe('Descriptor types', () => {
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
uninterpreted_option: []
})
assert.deepStrictEqual(service.HelloWithSomeOptions.options, {
deprecated: true,
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
uninterpreted_option: [],
'(google.api.http)': {
get: "/hello",
additional_bindings: {
body: '*',
get: '/hello-world'
}
},
})
})
});

View File

@ -13,7 +13,7 @@ message MethodSignature {
service Hello {
rpc Hello (Empty) returns (Empty) {
option deprecated = true;
option idempotency_level = IDEMPOTENCY_UNKNOWN;
option idempotency_level = NO_SIDE_EFFECTS;
option uninterpreted_option = {
name: {
name_part: 'foo'
@ -35,4 +35,14 @@ service Hello {
option (google.api.method_signature) = 'bar';
}
rpc HelloWithoutOptions (Empty) returns (Empty) {}
rpc HelloWithSomeOptions (Empty) returns (Empty) {
option deprecated = true;
option (google.api.http) = {
get: "/hello"
additional_bindings: {
get: "/hello-world"
body: "*"
}
};
}
}