utrack / clay

Proto-first minimal server platform for gRPС+REST+Swagger APIs
MIT License
289 stars 39 forks source link

interface conversion: interface {} is nil, not map[string]interface {} #51

Closed NOMORECOFFEE closed 5 years ago

NOMORECOFFEE commented 5 years ago

transport.NewCompoundServiceDesc().SwaggerDef() return: {"definitions":null,"paths":null} expect: {"definitions":{},"paths":{}} or not panic in example

s1 := transport.NewCompoundServiceDesc()
s2 := transport.NewCompoundServiceDesc(s1)

s2.SwaggerDef() // <-- panic

I think you shouldn't call type cast before nil check https://github.com/utrack/clay/blob/master/transport/swagcombo.go#L30-L36