Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add schemaFile to ValidationFile #2206

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading