Skip to content

Commit df545dd

Browse files
committed
Fixes missing field descriptions if the Message has index 2
1 parent 1e5a723 commit df545dd

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

examples/examplepb/streamless_everything.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ message EmptyMessage {
5959
}
6060

6161
message IdMessage {
62+
// uuid is UUID value
6263
string uuid = 1;
6364
}
6465

examples/examplepb/streamless_everything.swagger.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@
520520
"properties": {
521521
"uuid": {
522522
"type": "string",
523-
"format": "string"
523+
"format": "string",
524+
"title": "uuid is UUID value"
524525
}
525526
}
526527
},

protoc-gen-swagger/genswagger/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []str
564564
packageProtoPath := protoPathIndex(reflect.TypeOf((*pbdescriptor.FileDescriptorProto)(nil)), "Package")
565565
L1:
566566
for _, loc := range file.SourceCodeInfo.Location {
567-
if typeIndex != packageProtoPath {
567+
if typeName != "Package" || typeIndex != packageProtoPath {
568568
if len(loc.Path) < len(outerPaths)*2+2+len(fieldPaths) {
569569
continue
570570
}

0 commit comments

Comments
 (0)