mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 09:54: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"))
|
fmt.Println(bold.Render("Path Parameters"))
|
||||||
for _, param := range params.Path {
|
for _, param := range params.Path {
|
||||||
fmt.Println(boldparagraph.Render(param.Param))
|
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"))
|
fmt.Println(bold.Render("Query Parameters"))
|
||||||
for _, param := range params.Query {
|
for _, param := range params.Query {
|
||||||
fmt.Println(boldparagraph.Render(param.Param))
|
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) {
|
func matchOperation(showpath, verb string) (*Op, error) {
|
||||||
ops := []*Op{}
|
ops := []*Op{}
|
||||||
op := &Op{}
|
op := &Op{}
|
||||||
|
var found bool
|
||||||
|
|
||||||
for path, item := range assets.OpenAPI.Spec().Paths.Paths {
|
for path, item := range assets.OpenAPI.Spec().Paths.Paths {
|
||||||
if path == showpath {
|
if path == showpath {
|
||||||
@@ -471,10 +476,12 @@ func matchOperation(showpath, verb string) (*Op, error) {
|
|||||||
for _, item := range ops {
|
for _, item := range ops {
|
||||||
if strings.ToLower(item.Verb) == verb {
|
if strings.ToLower(item.Verb) == verb {
|
||||||
op = item
|
op = item
|
||||||
|
found = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if op == nil {
|
if !found {
|
||||||
return nil, errors.New("no matching API call found for given path+verb")
|
return nil, errors.New("no matching API call found for given path+verb")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user