Skip to content

Commit

Permalink
fix validation for alias (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
goccy committed Aug 20, 2024
1 parent 739457f commit bec3655
Show file tree
Hide file tree
Showing 8 changed files with 470 additions and 311 deletions.
412 changes: 244 additions & 168 deletions _examples/06_alias/federation/federation.pb.go

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions _examples/06_alias/federation/federation_grpc_federation.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions _examples/06_alias/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,15 @@ func TestFederation(t *testing.T) {
DupBody: "bodybody2",
},
},
M: &post.M{X: "xxx"},
Type: federation.PostType_POST_TYPE_BAR,
},
}, cmpopts.IgnoreUnexported(
federation.GetPostResponse{},
federation.Post{},
federation.PostData{},
federation.PostContent{},
post.M{},
)); diff != "" {
t.Errorf("(-got, +want)\n%s", diff)
}
Expand Down
135 changes: 98 additions & 37 deletions _examples/06_alias/post/post.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion _examples/06_alias/proto/federation/federation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ syntax = "proto3";
package org.federation;

import "grpc/federation/federation.proto";
import "post/post.proto";

option go_package = "example/federation;federation";

option (grpc.federation.file)= {
import: ["post/post.proto", "post/v2/post.proto"]
import: ["post/v2/post.proto"]
};

service FederationService {
Expand Down Expand Up @@ -79,6 +80,7 @@ message Post {
PostData data = 2;
PostData data2 = 3 [(grpc.federation.field).by = "data2"];
PostType type = 4 [(grpc.federation.field).by = "data_type2"];
org.post.M m = 5 [(grpc.federation.field).by = "M{x: 'xxx'}"];
}

enum PostType {
Expand Down Expand Up @@ -128,3 +130,9 @@ message PostContent {
string dup_body = 4 [(grpc.federation.field).alias = "body"];
map<int32, int32> counts = 5;
}

message M {
option (grpc.federation.message).alias = "org.post.M";

string x = 1;
}
4 changes: 4 additions & 0 deletions _examples/06_alias/proto/post/post.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ message PostConditionA {
}

message PostConditionB {}

message M {
string x = 1;
}
Loading

0 comments on commit bec3655

Please sign in to comment.