mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 06:24:18 +02:00
fixed another panic
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user