tailcall icon indicating copy to clipboard operation
tailcall copied to clipboard

bug(grpc): incorrect type names for nested messages

Open shashitnak opened this issue 10 months ago • 0 comments

Describe the bug

Type names generated for nested messages with the gen command are incorrect. Consider the following example:

message News {
    int32 id = 1;
    string title = 2;
    string body = 3;
    string postImage = 4;
    Status foo = 5;
    message Author { // nested field
        string name = 1;
        string email = 2;
    }
    Author author = 6;
}

Expected behavior

The generated types should look like the following

input NEWS_NEWS @tag(id: "news.News") {
  author: NEWS_NEWS_AUTHOR
  body: String
  foo: NEWS_STATUS
  id: Int
  post_image: String
  title: String
}

input NEWS_NEWS_AUTHOR @tag(id: "news.News.Author") {
  email: String
  name: String
}

NOTE: In NEWS_NEWS_AUTHOR the first NEWS signifies the news package and the second NEWS signifies that the type is defined inside the News message.

Actual behavior

Currently, the following types are generated

input NEWS_NEWS @tag(id: "news.News") {
  author: NEWS_AUTHOR
  body: String
  foo: NEWS_STATUS
  id: Int
  post_image: String
  title: String
}

input NEWS_AUTHOR @tag(id: "news.Author") {
  email: String
  name: String
}

shashitnak avatar Apr 18 '24 16:04 shashitnak