You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run protoc to generate the swagger for the service, observe the following panic:
panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger.templateToSwaggerPath(0xc0000b3230, 0x26, 0xc0000f28c0, 0x0, 0x0)
/Users/bob_allison/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go:688 +0xc38
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger.renderServices(0xc0000b44b0, 0x1, 0x1, 0xc0001d6000, 0xc0000f28c0, 0xc0001dee20, 0xc0001dedf0, 0x2e00000008, 0x8)
/Users/bob_allison/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go:732 +0x10f1
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger.applyTemplate(0xc0001b3780, 0xc0000f28c0, 0xc000169df0, 0x0, 0x1)
/Users/bob_allison/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/template.go:1066 +0x357
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger.(*generator).Generate(0xc0000b4310, 0xc0000b44b8, 0x1, 0x1, 0x1, 0xc0000b44b8, 0x0, 0x1, 0x340)
/Users/bob_allison/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/genswagger/generator.go:188 +0x6d9
main.main()
/Users/bob_allison/go/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/main.go:119 +0x7fb
--swagger_out: protoc-gen-swagger: Plugin failed with status code 2.
What did you expect to happen instead:
Creation of the apidocs file
What's your theory on why it isn't working:
The regexp object canRegexp does not differentiate between parent and {parent}, returning parent in both cases. This causes the test on line 686 to be incorrectly true leading to parsing the string on line 687 which results in an empty slice. The panic occurs when line 688 tries to read the second element of the slice without first checking the length.
The text was updated successfully, but these errors were encountered:
Steps you follow to reproduce the error:
Create the following proto file:
Run protoc to generate the swagger for the service, observe the following panic:
What did you expect to happen instead:
Creation of the apidocs file
What's your theory on why it isn't working:
The regexp object
canRegexp
does not differentiate betweenparent
and{parent}
, returningparent
in both cases. This causes the test on line 686 to be incorrectly true leading to parsing the string on line 687 which results in an empty slice. The panic occurs when line 688 tries to read the second element of the slice without first checking the length.The text was updated successfully, but these errors were encountered: