Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto nesting causes template generation problems #2717

Closed
songzhibin97 opened this issue Mar 10, 2023 · 0 comments · Fixed by #2718
Closed

proto nesting causes template generation problems #2717

songzhibin97 opened this issue Mar 10, 2023 · 0 comments · Fixed by #2718
Labels
bug Something isn't working

Comments

@songzhibin97
Copy link
Member

What happened:


message CreateTemplate {
    message Request {
        string template_name = 1;
        string bind_interface_key = 2;
        map<string, string> meta = 3;
    }
    message Response {
        message Data {
            int64 template_id = 1;
        }
        int64 code = 1;
        string message = 2;
        Data data = 3;
    }
}

message GetTemplates {
    message Request {
        int64 page = 1;
        int64 page_size = 2;
    }

    message Response {
        message Data {
            int64 template_id = 1;
            string template_name = 2;
        }
        int64 code = 1;
        string message = 2;
        Data data = 3;
    }
}

generate server

func (s *TemplateService) CreateTemplate(ctx context.Context, req *pb.CreateTemplate.Request) (*pb.CreateTemplate.Response, error) {
	return &pb.CreateTemplate.Response{}, nil
}
func (s *TemplateService) GetTemplates(ctx context.Context, req *pb.GetTemplates.Request) (*pb.GetTemplates.Response, error) {
	return &pb.GetTemplates.Response{}, nil
}
func (s *TemplateService) GetTemplateById(ctx context.Context, req *pb.GetTemplateById.Request) (*pb.GetTemplateById.Response, error) {
	return &pb.GetTemplateById.Response{}, nil
}
func (s *TemplateService) SaveTemplateById(ctx context.Context, req *pb.SaveTemplateById.Request) (*pb.SaveTemplateById.Response, error) {
	return &pb.SaveTemplateById.Response{}, nil
}
func (s *TemplateService) DeleteTemplateById(ctx context.Context, req *pb.DeleteTemplateById.Request) (*pb.DeleteTemplateById.Response, error) {
	return &pb.DeleteTemplateById.Response{}, nil
}

...


What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kratos version (use kratos -v):
    kratos version v2.6.1
  • Go version (use go version):
    1.19
  • OS (e.g: cat /etc/os-release):
    mac
  • Others:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant