Skip to content

Commit 4c185fa

Browse files
hiepthain0v1
authored andcommitted
grpc-loader: update interfaces & add new test
1 parent d335428 commit 4c185fa

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

packages/proto-loader/src/index.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ export interface EnumTypeDefinition extends ProtobufTypeDefinition {
116116
}
117117

118118
export enum IdempotencyLevel {
119-
IDEMPOTENCY_UNKNOWN = 0,
120-
NO_SIDE_EFFECTS = 1,
121-
IDEMPOTENT = 2
119+
IDEMPOTENCY_UNKNOWN = 'IDEMPOTENCY_UNKNOWN',
120+
NO_SIDE_EFFECTS = 'NO_SIDE_EFFECTS',
121+
IDEMPOTENT = 'IDEMPOTENT'
122122
}
123123

124124
export interface NamePart {
@@ -136,16 +136,11 @@ export interface UninterpretedOption {
136136
aggregate_value?: string;
137137
}
138138

139-
export interface CustomHttpPattern {
140-
kind?: string;
141-
path?: string;
142-
}
143-
144139
export interface MethodOptions {
145-
deprecated?: (boolean|null);
146-
idempotency_level?: (IdempotencyLevel|keyof typeof IdempotencyLevel|null);
147-
uninterpreted_option?: (UninterpretedOption[]|null);
148-
[k: string]: unknown
140+
deprecated?: boolean;
141+
idempotency_level?: IdempotencyLevel|keyof typeof IdempotencyLevel;
142+
uninterpreted_option?: UninterpretedOption;
143+
[k: string]: unknown;
149144
}
150145

151146
export interface MethodDefinition<RequestType, ResponseType, OutputRequestType=RequestType, OutputResponseType=ResponseType> {

packages/proto-loader/test/descriptor_type_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,6 @@ describe('Descriptor types', () => {
160160
},
161161
'(google.api.method_signature)': 'bar'
162162
})
163+
assert(service.HelloWithoutOptions.options === undefined)
163164
})
164165
});

packages/proto-loader/test_protos/method_options.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ service Hello {
3434
};
3535
option (google.api.method_signature) = 'bar';
3636
}
37+
rpc HelloWithoutOptions (Empty) returns (Empty) {}
3738
}

0 commit comments

Comments
 (0)