Skip to content

Commit

Permalink
fix(http-mock-gen): methods should in serverName, to fix generater error
Browse files Browse the repository at this point in the history
  • Loading branch information
liangskyli committed Aug 16, 2024
1 parent 727c2ab commit 6633b8a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/grpc-mock/src/gen/gen-mock-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const genMockData = async (
rootPathServerNameMap?.[spaceServerName] ?? spaceServerName;
const root = protobufjs.Root.fromJSON(rootObject[spaceServerName]);
const result: IInspectNamespace = inspectNamespace(root);
const { services, methods } = result!;
const { services } = result!;
const genServiceMockData = new GenServiceMockData({
genServerPath,
prettierOptions,
Expand All @@ -109,6 +109,7 @@ const genMockData = async (
const protoName = service.fullName.split('.')[0];
const protoPath = `${spaceServerName}.${service.fullName}`;
const serviceCodeName = firstWordNeedLetter(service.name);
const methods = service.methods ?? [];

await new GenProtoMockData({
index,
Expand Down
44 changes: 44 additions & 0 deletions packages/grpc-mock/test/proto-servers/server2/activity2-new.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";

package activity_package_new;


// 活动服务
service ActivityService2 {
// 新增活动
rpc Create(CreateActivityRequest2New) returns (CreateActivityResponse2New);
}

message CreateActivityRequest2New {
// 活动Id
string activityId = 1;
}

message CreateActivityResponse2New {
// 活动名称
string activityName = 1;
// key:活动ID, value: 资源提供方(0:配置 1:分销通:中介门店 2:分销通项目地址)
// @required
map<string,ResourceProviders> activityResourceProviders = 2;

// 微信订阅通知模板列表
// {
// "a-id": "模板a",
// "b-id": "模板b",
// }
// @required
map<string,string> templates = 3;
// @required
map<int32,string> intKeyTemplates = 4;
// number类型
int32 count = 5;
// string 转 number类型
int64 longCount = 6;
// bool类型
bool isGood = 7;
}

message ResourceProviders{
// @required
repeated int32 resourceProviders = 1;
}

0 comments on commit 6633b8a

Please sign in to comment.