Skip to content

Commit 5d545b3

Browse files
authored
Merge pull request #67 from A-Hilaly/issue/773/sdkfind-2
panic if matchFieldName config contains an element that is not part of Spec or Status fields
2 parents 6865258 + cc05fbf commit 5d545b3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/generate/code/set_resource.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@ func setResourceReadMany(
416416
// operation by checking for matching values in these fields.
417417
matchFieldNames := r.ListOpMatchFieldNames()
418418

419+
for _, matchFieldName := range matchFieldNames {
420+
_, foundSpec := r.SpecFields[matchFieldName]
421+
_, foundStatus := r.StatusFields[matchFieldName]
422+
if !foundSpec && !foundStatus {
423+
msg := fmt.Sprintf(
424+
"Match field name %s is not in %s Spec or Status fields",
425+
matchFieldName, r.Names.Camel,
426+
)
427+
panic(msg)
428+
}
429+
}
430+
419431
// found := false
420432
out += fmt.Sprintf("%sfound := false\n", indent)
421433
// for _, elem := range resp.CacheClusters {

0 commit comments

Comments
 (0)