Skip to content
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

Optional SourceCodeInfo #466

Merged
merged 1 commit into from
Oct 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions protoc-gen-swagger/genswagger/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"os"
"reflect"
"regexp"
"strconv"
Expand Down Expand Up @@ -722,13 +723,8 @@ func enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) str

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

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