-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: multi package name in grpc client (#917)
- Loading branch information
1 parent
351d5c9
commit 9e08c93
Showing
9 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/grpc/test/fixtures/base-app-multiple-package/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "ali-demo" | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/grpc/test/fixtures/base-app-multiple-package/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({ | ||
imports: [ | ||
], | ||
}) | ||
export class AutoConfiguration { | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/grpc/test/fixtures/base-app-multiple-package/src/interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { IClientOptions, IClientUnaryService } from '../../../../src'; | ||
|
||
export namespace hello { | ||
export namespace world { | ||
export interface HelloRequest { | ||
name: string; | ||
} | ||
|
||
export interface HelloReply { | ||
message: string; | ||
} | ||
|
||
// The greeting service definition. | ||
export interface Greeter { | ||
// Sends a greeting | ||
sayHello(data: HelloRequest): Promise<HelloReply>; | ||
} | ||
|
||
export interface GreeterClient { | ||
sayHello (options?: IClientOptions): IClientUnaryService<HelloRequest, HelloReply> | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
packages/grpc/test/fixtures/base-app-multiple-package/src/provider/greeter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { MSProviderType, Provider, Provide, Inject, GrpcMethod } from '@midwayjs/decorator'; | ||
import { hello } from '../interface'; | ||
import { ILogger } from '@midwayjs/logger'; | ||
import { Context } from '../../../../../src'; | ||
|
||
/** | ||
* package helloworld | ||
* service Greeter | ||
*/ | ||
@Provide() | ||
@Provider(MSProviderType.GRPC, { package: 'hello.world' }) | ||
export class Greeter implements hello.world.Greeter { | ||
|
||
@Inject() | ||
logger: ILogger; | ||
|
||
@Inject() | ||
ctx: Context; | ||
|
||
/** | ||
* Implements the SayHello RPC method. | ||
*/ | ||
@GrpcMethod() | ||
async sayHello(request: hello.world.HelloRequest) { | ||
return { message: 'Hello ' + request.name }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2015 gRPC authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "io.grpc.examples.hello.world"; | ||
option java_outer_classname = "HelloWorldProto"; | ||
option objc_class_prefix = "HLW"; | ||
|
||
package hello.world; | ||
|
||
// The greeting service definition. | ||
service Greeter { | ||
// Sends a greeting | ||
rpc SayHello (HelloRequest) returns (HelloReply) {} | ||
} | ||
|
||
// The request message containing the user's name. | ||
message HelloRequest { | ||
string name = 1; | ||
} | ||
|
||
// The response message containing the greetings | ||
message HelloReply { | ||
string message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters