Skip to content

Commit

Permalink
grpc-loader: update interfaces & add new test
Browse files Browse the repository at this point in the history
  • Loading branch information
hiepthai authored and n0v1 committed Apr 5, 2024
1 parent d335428 commit 4c185fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
19 changes: 7 additions & 12 deletions packages/proto-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export interface EnumTypeDefinition extends ProtobufTypeDefinition {
}

export enum IdempotencyLevel {
IDEMPOTENCY_UNKNOWN = 0,
NO_SIDE_EFFECTS = 1,
IDEMPOTENT = 2
IDEMPOTENCY_UNKNOWN = 'IDEMPOTENCY_UNKNOWN',
NO_SIDE_EFFECTS = 'NO_SIDE_EFFECTS',
IDEMPOTENT = 'IDEMPOTENT'
}

export interface NamePart {
Expand All @@ -136,16 +136,11 @@ export interface UninterpretedOption {
aggregate_value?: string;
}

export interface CustomHttpPattern {
kind?: string;
path?: string;
}

export interface MethodOptions {
deprecated?: (boolean|null);
idempotency_level?: (IdempotencyLevel|keyof typeof IdempotencyLevel|null);
uninterpreted_option?: (UninterpretedOption[]|null);
[k: string]: unknown
deprecated?: boolean;
idempotency_level?: IdempotencyLevel|keyof typeof IdempotencyLevel;
uninterpreted_option?: UninterpretedOption;
[k: string]: unknown;
}

export interface MethodDefinition<RequestType, ResponseType, OutputRequestType=RequestType, OutputResponseType=ResponseType> {
Expand Down
1 change: 1 addition & 0 deletions packages/proto-loader/test/descriptor_type_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,6 @@ describe('Descriptor types', () => {
},
'(google.api.method_signature)': 'bar'
})
assert(service.HelloWithoutOptions.options === undefined)
})
});
1 change: 1 addition & 0 deletions packages/proto-loader/test_protos/method_options.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ service Hello {
};
option (google.api.method_signature) = 'bar';
}
rpc HelloWithoutOptions (Empty) returns (Empty) {}
}

0 comments on commit 4c185fa

Please sign in to comment.