mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-11 23:40:57 +00:00
Generate appropriate schema doc comments from .proto files
- Add parse handling of .proto struct and field doc comments (enums and their values were already handled) - Add FBS generation handling of doc comments for structs, their fields, enums, and their values (requires linking idl_gen_general in the test binary build) - Tested using test.proto|golden with doc comments added. Xcode run of flattest passes. Change-Id: Idff64dd8064afba227174ab77d2c7be22d006628
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
b8708beeec
commit
3ad853630c
@@ -2,28 +2,37 @@
|
||||
|
||||
namespace proto.test;
|
||||
|
||||
/// Enum doc comment.
|
||||
enum ProtoEnum : short {
|
||||
FOO = 1,
|
||||
/// Enum 2nd value doc comment misaligned.
|
||||
BAR = 5,
|
||||
}
|
||||
|
||||
table OtherMessage {
|
||||
a:double;
|
||||
/// doc comment for b.
|
||||
b:float = 3.14149;
|
||||
}
|
||||
|
||||
/// 2nd table doc comment with
|
||||
/// many lines.
|
||||
table ProtoMessage {
|
||||
c:int = 16;
|
||||
d:long;
|
||||
p:uint;
|
||||
e:ulong;
|
||||
/// doc comment for f.
|
||||
f:int = -1;
|
||||
g:long;
|
||||
h:uint;
|
||||
q:ulong;
|
||||
i:int;
|
||||
j:long;
|
||||
/// doc comment for k.
|
||||
k:bool;
|
||||
/// doc comment for l on 2
|
||||
/// lines
|
||||
l:string (required);
|
||||
m:string;
|
||||
n:OtherMessage;
|
||||
|
||||
@@ -5,28 +5,38 @@ package proto.test;
|
||||
option some_option = is_ignored;
|
||||
import "some_other_schema.proto";
|
||||
|
||||
/// Enum doc comment.
|
||||
enum ProtoEnum {
|
||||
FOO = 1;
|
||||
/// Enum 2nd value doc comment misaligned.
|
||||
BAR = 5;
|
||||
}
|
||||
|
||||
// Ignored non-doc comment.
|
||||
message OtherMessage {
|
||||
optional double a = 26;
|
||||
/// doc comment for b.
|
||||
optional float b = 32 [default = 3.14149];
|
||||
}
|
||||
|
||||
/// 2nd table doc comment with
|
||||
/// many lines.
|
||||
message ProtoMessage {
|
||||
optional int32 c = 12 [default = 16];
|
||||
optional int64 d = 1 [default = 0];
|
||||
optional uint32 p = 1;
|
||||
optional uint64 e = 2;
|
||||
/// doc comment for f.
|
||||
optional sint32 f = 3 [default = -1];
|
||||
optional sint64 g = 4;
|
||||
optional fixed32 h = 5;
|
||||
optional fixed64 q = 6;
|
||||
optional sfixed32 i = 7;
|
||||
optional sfixed64 j = 8;
|
||||
/// doc comment for k.
|
||||
optional bool k = 9;
|
||||
/// doc comment for l on 2
|
||||
/// lines
|
||||
required string l = 10;
|
||||
optional bytes m = 11;
|
||||
optional OtherMessage n = 12;
|
||||
|
||||
Reference in New Issue
Block a user