Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #155 from shomron/dont-point-to-range-variable
Browse files Browse the repository at this point in the history
Fix scan for body parameter in ksonnet.parsePaths()
  • Loading branch information
shomron authored Nov 5, 2018
2 parents ed0796f + c848e79 commit d03da23
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ksonnet-gen/ksonnet/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ func parsePaths(apiSpec *spec.Swagger) (map[string]Component, error) {
continue
}

var body *spec.Parameter
var body spec.Parameter
var hasBody bool
for _, param := range verb.Parameters {
if param.Name == "body" {
body = &param
body = param // shallow copy
hasBody = true
break
}
}

if body == nil {
if !hasBody {
continue
}

if body.Schema == nil {
return nil, errors.Errorf("invalid body parameter - missing required field: schema")
}
ref := extractRef(*body.Schema)

component, exists, err := pathExtensionComponent(verb.Extensions)
Expand Down

0 comments on commit d03da23

Please sign in to comment.