Skip to content

Allows the [Description] feature to be added, with comments when gene… #1163

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

Closed
wants to merge 2 commits into from

Conversation

whuanle
Copy link

@whuanle whuanle commented Jul 11, 2024

For model class:

        [Description("BookDescription")]
        [DataContract]
        public class BookDescription
        {
            [Description("ID")]
            [DataMember(Order = 1)]
            public int ID { get; set; }

            [Description("Title")]
            [DataMember(Order = 2)]
            public string Title { get; set; }

            [Description("Tags")]
            public Dictionary<int, string> Tags { get; set; }

            [Description("PriceChanges")]
            public int[] PriceChanges { get; set; }
            [Description("Type")]
            public BookType Type { get; set; }
        }

Build example:

syntax = ""proto3"";
package protobuf_net.Grpc.Reflection.Test;
import ""google/protobuf/empty.proto"";

// BookDescription
message BookDescription {
   // ID
   int32 ID = 1;
   // Title
   string Title = 2;
}
// BookType
enum BookType {
   Biology = 0;
   Chemistry = 1;
}
// BookDescription
message BookTypeDescription {
}
// BookService
service BookService {
   // GetBookInfo
   rpc GetBookInfo (.google.protobuf.Empty) returns (BookDescription);
   // GetBookTypes
   rpc GetBookTypes (.google.protobuf.Empty) returns (BookTypeDescription);
}

@whuanle whuanle closed this Jul 12, 2024
@Alinccc
Copy link

Alinccc commented Apr 8, 2025

I have this need! tks

@whuanle
Copy link
Author

whuanle commented Apr 10, 2025

@Alinccc
see #1164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants