mirror of https://github.com/grpc/grpc-node.git
return uninterpreted options as an array
This commit is contained in:
parent
6e441a8d03
commit
e6ac1a49ed
|
|
@ -250,7 +250,18 @@ function createSerializer(cls: Protobuf.Type): Serialize<object> {
|
|||
}
|
||||
|
||||
function mapMethodOptions(options: Partial<MethodOptions>[] | undefined): MethodOptions {
|
||||
return (options || []).reduce((obj: MethodOptions, item: Partial<MethodOptions>) => ({ ...obj, ...item }),
|
||||
return (options || []).reduce((obj: MethodOptions, item: Partial<MethodOptions>) => {
|
||||
for (const [key, value] of Object.entries(item)) {
|
||||
switch (key) {
|
||||
case 'uninterpreted_option' :
|
||||
obj.uninterpreted_option.push(item.uninterpreted_option as UninterpretedOption);
|
||||
break;
|
||||
default:
|
||||
obj[key] = value
|
||||
}
|
||||
}
|
||||
return obj
|
||||
},
|
||||
{
|
||||
deprecated: false,
|
||||
idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN,
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ describe('Descriptor types', () => {
|
|||
assert.deepStrictEqual(service.Hello.options, {
|
||||
deprecated: true,
|
||||
idempotency_level: 'NO_SIDE_EFFECTS',
|
||||
uninterpreted_option: {
|
||||
uninterpreted_option: [{
|
||||
name: {
|
||||
name_part: 'foo',
|
||||
is_extension: false,
|
||||
|
|
@ -151,7 +151,7 @@ describe('Descriptor types', () => {
|
|||
double_value: 1.2345,
|
||||
string_value: 'foobar',
|
||||
aggregate_value: 'foobar'
|
||||
},
|
||||
}],
|
||||
'(google.api.http)': {
|
||||
post: '/hello',
|
||||
body: '*',
|
||||
|
|
|
|||
Loading…
Reference in New Issue