grpc-loader: update & correct interface types

This commit is contained in:
hiepthai 2022-10-26 10:41:18 +07:00 committed by Christopher Fenn
parent ae33e8797a
commit 68ea1f43e2
3 changed files with 42 additions and 14 deletions

View File

@ -122,18 +122,18 @@ export enum IdempotencyLevel {
}
export interface NamePart {
namePart: string;
isExtension: boolean;
name_part: string;
is_extension: boolean;
}
export interface UninterpretedOption {
name?: (NamePart[]|null);
identifierValue?: (string|null);
positiveIntValue?: (number|Long|string|null);
negativeIntValue?: (number|Long|string|null);
doubleValue?: (number|null);
stringValue?: (Uint8Array|string|null);
aggregateValue?: (string|null);
identifier_value?: (string|null);
positive_int_value?: (number|null);
negative_int_value?: (number|null);
double_value?: (number|null);
string_value?: (string|null);
aggregate_value?: (string|null);
}
export interface CustomHttpPattern {
@ -150,8 +150,8 @@ export interface HttpRule {
patch?: (string|null);
custom?: (CustomHttpPattern|null);
body?: (string|null);
responseBody?: (string|null);
additionalBindings?: (HttpRule[]|null);
response_body?: (string|null);
additional_bindings?: (HttpRule[]|null);
}
export interface MethodOptions {

View File

@ -140,8 +140,24 @@ describe('Descriptor types', () => {
assert.deepStrictEqual(service.Hello.options, {
deprecated: true,
idempotency_level: 'IDEMPOTENCY_UNKNOWN',
uninterpreted_option: { identifier_value: 'foo' },
'(google.api.http)': { post: '/hello' },
uninterpreted_option: {
name: {
name_part: 'foo',
is_extension: false,
},
identifier_value: 'bar',
positive_int_value: 9007199254740991,
negative_int_value: -9007199254740991,
double_value: 1.2345,
string_value: 'foobar',
aggregate_value: 'foobar'
},
'(google.api.http)': {
post: "/hello",
body: "*",
response_body: "*",
additional_bindings: {}
},
'(google.api.method_signature)': 'bar'
})
})

View File

@ -7,7 +7,7 @@ import "google/api/httpbody.proto";
message Empty {}
message MethodSignature {
repeated string method_signature = 0;
repeated string method_signature = 1;
}
service Hello {
@ -15,10 +15,22 @@ service Hello {
option deprecated = true;
option idempotency_level = IDEMPOTENCY_UNKNOWN;
option uninterpreted_option = {
identifier_value: 'foo'
name: {
name_part: 'foo'
is_extension: false
}
identifier_value: 'bar'
positive_int_value: 9007199254740991
negative_int_value: -9007199254740991
double_value: 1.2345
string_value: 'foobar'
aggregate_value: 'foobar'
};
option (google.api.http) = {
post: "/hello"
body: "*"
response_body: "*"
additional_bindings: {}
};
option (google.api.method_signature) = 'bar';
}