Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
chore: add nil check in InstillAcceptFormats validator (#378)
Browse files Browse the repository at this point in the history
Because

- The InstillAcceptFormats validator

This commit

- Adds nil check in InstillAcceptFormats validator
  • Loading branch information
donch1989 authored Sep 27, 2024
1 parent cd5e34f commit fa9eb17
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ func CompileInstillAcceptFormats(sch *structpb.Struct) error {
}
}
if len(itemInstillAcceptFormats) > 0 {
if _, ok := sch.Fields["items"]; !ok {
sch.Fields["items"] = structpb.NewStructValue(&structpb.Struct{Fields: make(map[string]*structpb.Value)})
}
sch.Fields["items"].GetStructValue().Fields["instillAcceptFormats"], err = structpb.NewValue(itemInstillAcceptFormats)
if err != nil {
return err
Expand Down

0 comments on commit fa9eb17

Please sign in to comment.