Skip to content

Commit

Permalink
ref
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-fbudzynski committed Dec 18, 2024
1 parent c60dec5 commit df0563b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/sdk/poc/generator/show_object_methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func (s *Operation) withShowObjectMethods(structName string, showObjectMethodsKi
log.Printf("[WARN]: %v, for showObjectIdMethod", err)
continue
}
if !hasRequiredFieldsForIDMethod(structName, s.HelperStructs, id) {
log.Printf("[WARN]: Struct '%s' does not contain needed fields to build ID() helper method. Create the method manually in _ext file or add missing fields: %v.\n", structName, idTypeParts[id])
return nil
}
s.ShowObjectMethods = append(s.ShowObjectMethods, newShowObjectIDMethod(structName, s.HelperStructs, id))
case ShowObjectTypeMethod:
s.ShowObjectMethods = append(s.ShowObjectMethods, newShowObjectTypeMethod(structName))
Expand All @@ -81,13 +85,9 @@ func (s *Operation) withShowObjectMethods(structName string, showObjectMethodsKi
}

func newShowObjectIDMethod(structName string, helperStructs []*Field, idType objectIdentifier) *ShowObjectMethod {
if !hasRequiredFieldsForIDMethod(structName, helperStructs, idType) {
log.Printf("[WARN]: Struct '%s' does not contain needed fields to build ID() helper method. Create the method manually in _ext file or add missing fields: %v.\n", structName, idTypeParts[idType])
return nil
}
fields := idTypeParts[idType]
requiredFields := idTypeParts[idType]
var args string
for _, field := range fields {
for _, field := range requiredFields {
args += fmt.Sprintf("v.%v, ", field)
}

Expand Down

0 comments on commit df0563b

Please sign in to comment.