grpc-loader: update interfaces & add new test

This commit is contained in:
hiepthai 2022-10-27 07:59:26 +07:00 committed by Christopher Fenn
parent d335428458
commit 4c185fa2e6
3 changed files with 9 additions and 12 deletions

View File

@ -116,9 +116,9 @@ export interface EnumTypeDefinition extends ProtobufTypeDefinition {
} }
export enum IdempotencyLevel { export enum IdempotencyLevel {
IDEMPOTENCY_UNKNOWN = 0, IDEMPOTENCY_UNKNOWN = 'IDEMPOTENCY_UNKNOWN',
NO_SIDE_EFFECTS = 1, NO_SIDE_EFFECTS = 'NO_SIDE_EFFECTS',
IDEMPOTENT = 2 IDEMPOTENT = 'IDEMPOTENT'
} }
export interface NamePart { export interface NamePart {
@ -136,16 +136,11 @@ export interface UninterpretedOption {
aggregate_value?: string; aggregate_value?: string;
} }
export interface CustomHttpPattern {
kind?: string;
path?: string;
}
export interface MethodOptions { export interface MethodOptions {
deprecated?: (boolean|null); deprecated?: boolean;
idempotency_level?: (IdempotencyLevel|keyof typeof IdempotencyLevel|null); idempotency_level?: IdempotencyLevel|keyof typeof IdempotencyLevel;
uninterpreted_option?: (UninterpretedOption[]|null); uninterpreted_option?: UninterpretedOption;
[k: string]: unknown [k: string]: unknown;
} }
export interface MethodDefinition<RequestType, ResponseType, OutputRequestType=RequestType, OutputResponseType=ResponseType> { export interface MethodDefinition<RequestType, ResponseType, OutputRequestType=RequestType, OutputResponseType=ResponseType> {

View File

@ -160,5 +160,6 @@ describe('Descriptor types', () => {
}, },
'(google.api.method_signature)': 'bar' '(google.api.method_signature)': 'bar'
}) })
assert(service.HelloWithoutOptions.options === undefined)
}) })
}); });

View File

@ -34,4 +34,5 @@ service Hello {
}; };
option (google.api.method_signature) = 'bar'; option (google.api.method_signature) = 'bar';
} }
rpc HelloWithoutOptions (Empty) returns (Empty) {}
} }