Skip to content

Commit

Permalink
Merge pull request #2206 from kartikaysaxena/schemaFile
Browse files Browse the repository at this point in the history
add schemaFile to ValidationFile
  • Loading branch information
tstirrat15 authored Jan 14, 2025
2 parents db2cf01 + a11be4a commit a80f596
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/validationfile/fileformat.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type ValidationFile struct {
// ValidationTuples are the validation tuples, in tuple string syntax.
// Deprecated: only for internal use. Use `relationships`.
ValidationTuples []string `yaml:"validation_tuples"`

// Schema file represents the path specified for the schema file
SchemaFile string `yaml:"schemaFile"`
}

// ParseAssertionsBlock parses the given contents as an assertions block.
Expand Down
12 changes: 12 additions & 0 deletions pkg/validationfile/fileformat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ validation:
}
}

func TestDecodeValidationFileWithoutSchema(t *testing.T) {
_, err := DecodeValidationFile([]byte(`schemaFile: >-
someschemafilehere.zed
relationships: >-
document:firstdoc#writer@user:tom
`))
errWithSource, ok := spiceerrors.AsWithSourceError(err)
require.False(t, ok)
require.Nil(t, errWithSource)
}

func TestDecodeRelationshipsErrorLineNumber(t *testing.T) {
_, err := DecodeValidationFile([]byte(`schema: >-
definition user {}
Expand Down

0 comments on commit a80f596

Please # to comment.