Skip to content

Commit

Permalink
Merge pull request #67 from A-Hilaly/issue/773/sdkfind-2
Browse files Browse the repository at this point in the history
panic if matchFieldName config contains an element that is not part of Spec or Status fields
  • Loading branch information
jaypipes authored May 17, 2021
2 parents 6865258 + cc05fbf commit 5d545b3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/generate/code/set_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,18 @@ func setResourceReadMany(
// operation by checking for matching values in these fields.
matchFieldNames := r.ListOpMatchFieldNames()

for _, matchFieldName := range matchFieldNames {
_, foundSpec := r.SpecFields[matchFieldName]
_, foundStatus := r.StatusFields[matchFieldName]
if !foundSpec && !foundStatus {
msg := fmt.Sprintf(
"Match field name %s is not in %s Spec or Status fields",
matchFieldName, r.Names.Camel,
)
panic(msg)
}
}

// found := false
out += fmt.Sprintf("%sfound := false\n", indent)
// for _, elem := range resp.CacheClusters {
Expand Down

0 comments on commit 5d545b3

Please sign in to comment.