fixed another panic

This commit is contained in:
2026-06-17 14:26:28 +02:00
parent 2f029304f3
commit 5d345aaa9a

View File

@@ -351,7 +351,9 @@ func ApiShow(conf *cfg.Config, showpath, verb string) error {
fmt.Println(bold.Render("Path Parameters"))
for _, param := range params.Path {
fmt.Println(boldparagraph.Render(param.Param))
fmt.Println(indentparagraph.Render(param.Description))
if param.Description != "" {
fmt.Println(indentparagraph.Render(param.Description))
}
}
}
@@ -359,7 +361,9 @@ func ApiShow(conf *cfg.Config, showpath, verb string) error {
fmt.Println(bold.Render("Query Parameters"))
for _, param := range params.Query {
fmt.Println(boldparagraph.Render(param.Param))
fmt.Println(indentparagraph.Render(param.Description))
if param.Description != "" {
fmt.Println(indentparagraph.Render(param.Description))
}
}
}
@@ -452,6 +456,7 @@ func getApiExample(op *Op) string {
func matchOperation(showpath, verb string) (*Op, error) {
ops := []*Op{}
op := &Op{}
var found bool
for path, item := range assets.OpenAPI.Spec().Paths.Paths {
if path == showpath {
@@ -471,10 +476,12 @@ func matchOperation(showpath, verb string) (*Op, error) {
for _, item := range ops {
if strings.ToLower(item.Verb) == verb {
op = item
found = true
break
}
}
if op == nil {
if !found {
return nil, errors.New("no matching API call found for given path+verb")
}