diff --git a/pkg/validationfile/fileformat.go b/pkg/validationfile/fileformat.go index d38d60786d..026ca4cde9 100644 --- a/pkg/validationfile/fileformat.go +++ b/pkg/validationfile/fileformat.go @@ -1,13 +1,8 @@ package validationfile import ( - "errors" - yamlv3 "gopkg.in/yaml.v3" - "github.com/ccoveille/go-safecast" - - "github.com/authzed/spicedb/pkg/spiceerrors" "github.com/authzed/spicedb/pkg/validationfile/blocks" ) @@ -48,36 +43,6 @@ type ValidationFile struct { SchemaFile string `yaml:"schemaFile"` } -func (vf *ValidationFile) UnmarshalYAML(node *yamlv3.Node) error { - type alias ValidationFile // To avoid recursion during decoding - temp := &alias{} - if err := node.Decode(temp); err != nil { - return err - } - - *vf = ValidationFile(*temp) - - // 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", - line, - column, - ) - } - return nil -} - // ParseAssertionsBlock parses the given contents as an assertions block. func ParseAssertionsBlock(contents []byte) (*blocks.Assertions, error) { return blocks.ParseAssertionsBlock(contents)