Skip to content

Commit 82b83c7

Browse files
emcfarlaneachew22
authored andcommitted
protoc-gen-swagger optional SourceCodeInfo
1 parent 1fd8ba6 commit 82b83c7

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

protoc-gen-swagger/genswagger/template.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7+
"os"
78
"reflect"
89
"regexp"
910
"strconv"
@@ -722,13 +723,8 @@ func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) str
722723

723724
func protoComments(reg *descriptor.Registry, file *descriptor.File, outers []string, typeName string, typeIndex int32, fieldPaths ...int32) string {
724725
if file.SourceCodeInfo == nil {
725-
// Curious! A file without any source code info.
726-
// This could be a test that's providing incomplete
727-
// descriptor.File information.
728-
//
729-
// We could simply return no comments, but panic
730-
// could make debugging easier.
731-
panic("descriptor.File should not contain nil SourceCodeInfo")
726+
fmt.Fprintln(os.Stderr, "descriptor.File should not contain nil SourceCodeInfo")
727+
return ""
732728
}
733729

734730
outerPaths := make([]int32, len(outers))

0 commit comments

Comments
 (0)