Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
  • Loading branch information
kartikaysaxena committed Jan 14, 2025
1 parent 4003af3 commit bfb81ea
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pkg/validationfile/fileformat.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import (
"errors"
"fmt"

"errors"
"fmt"

yamlv3 "gopkg.in/yaml.v3"

"github.com/authzed/spicedb/pkg/spiceerrors"
"github.com/ccoveille/go-safecast"

"github.com/authzed/spicedb/pkg/spiceerrors"
"github.com/authzed/spicedb/pkg/validationfile/blocks"
"github.com/ccoveille/go-safecast"
)

// DecodeValidationFile decodes the validation file as found in the contents bytes
Expand Down Expand Up @@ -77,11 +74,20 @@ func (vf *ValidationFile) UnmarshalYAML(node *yamlv3.Node) error {

// Enforce either one of schema or schemaFile is set.
if vf.Schema == (blocks.ParsedSchema{}) && temp.SchemaFile == "" {
line, err := safecast.ToUint64(node.Line)
if err != nil {
return err
}
column, err := safecast.ToUint64(node.Column)
if err != nil {
return err
}

return spiceerrors.NewWithSourceError(
errors.New("validation file must specify either 'schema' or 'schemaFile'"),
"validation file",
uint64(node.Line),
uint64(node.Column),
line,
column,
)
}
return nil
Expand Down

0 comments on commit bfb81ea

Please sign in to comment.