danielgtaylor / openapi-cli-generator

Generate a CLI from an OpenAPI 3 specification
MIT License
179 stars 49 forks source link

Crash with empty list + `--raw` #17

Closed danielgtaylor closed 5 years ago

danielgtaylor commented 5 years ago

When getting an empty list of data either as the response or queried via --query it will cause a crash when paired with --raw:

panic: runtime error: index out of range

goroutine 1 [running]:
github.com/danielgtaylor/openapi-cli-generator/cli.(*DefaultFormatter).Format(0xc0004b55ff, 0x1680080, 0xc000424440, 0x16b1060, 0xc0002e18f0)
    /Users/dan/Projects/pkg/mod/github.com/danielgtaylor/openapi-cli-generator@v0.0.0-20181107171938-2528a77e8e33/cli/formatter.go:142 +0xa7f