Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com>
  • Loading branch information
pierre-emmanuelJ committed Feb 15, 2024
1 parent 61a8d40 commit c634f45
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions v3/generator/operations/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func renderGettable(funcName string, s *base.SchemaProxy) ([]byte, error) {
return nil, nil
}

if sc.Type[0] != "object" {
if len(sc.Type) > 0 && sc.Type[0] != "object" {
return nil, nil
}

Expand All @@ -311,7 +311,7 @@ func renderGettable(funcName string, s *base.SchemaProxy) ([]byte, error) {
}
schemas.InferType(prop)

if prop.Type[0] != "array" {
if len(prop.Type) > 0 && prop.Type[0] != "array" {
continue
}

Expand All @@ -332,9 +332,9 @@ func renderGettable(funcName string, s *base.SchemaProxy) ([]byte, error) {
typeName = helpers.RenderReference(prop.Items.A.GetReference())
}

_, name := item.Properties["name"]
_, id := item.Properties["id"]
if name && id {
_, hasName := item.Properties["name"]
_, hasID := item.Properties["id"]
if hasName && hasID {
output := bytes.NewBuffer([]byte{})
t, err := template.New("Gettable").Parse(gettableTemplate)
if err != nil {
Expand Down

0 comments on commit c634f45

Please # to comment.