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

Fix scan for body parameter in ksonnet.parsePaths() #155

Merged
merged 1 commit into from
Nov 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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