Require validation preparation internally
This commit is contained in:
@@ -19,7 +19,7 @@ func TestValidationCancellationBeforeWorkDoesNotOpenSchemaSource(t *testing.T) {
|
||||
source := &countingSchemaFS{FS: fstest.MapFS{
|
||||
"schema.json": {Data: []byte(`{"type":"object"}`)},
|
||||
}}
|
||||
validator := NewFSValidator(source, ".").(ValidationPreparer)
|
||||
validator := NewFSValidator(source, ".")
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestValidationCancellationBetweenReferencedSchemaReadChunks(t *testing.T) {
|
||||
target: "child.json",
|
||||
cancel: cancel,
|
||||
}
|
||||
validator := NewFSValidator(source, ".").(ValidationPreparer)
|
||||
validator := NewFSValidator(source, ".")
|
||||
|
||||
plan, err := validator.PrepareValidation(ctx, domain.OutputContract{
|
||||
ValidationMode: domain.ValidationJSONSchema,
|
||||
@@ -113,7 +113,7 @@ func TestCancellationDoesNotDetachBlockedSchemaRead(t *testing.T) {
|
||||
started: started,
|
||||
release: release,
|
||||
}
|
||||
validator := NewFSValidator(source, ".").(ValidationPreparer)
|
||||
validator := NewFSValidator(source, ".")
|
||||
type outcome struct {
|
||||
plan PreparedValidation
|
||||
err error
|
||||
|
||||
@@ -34,11 +34,11 @@ type FSValidator struct {
|
||||
root string
|
||||
}
|
||||
|
||||
func NewStandardValidator(schemaBaseDir string) Validator {
|
||||
func NewStandardValidator(schemaBaseDir string) *StandardValidator {
|
||||
return &StandardValidator{schemaBaseDir: schemaBaseDir}
|
||||
}
|
||||
|
||||
func NewFSValidator(fsys fs.FS, root string) Validator {
|
||||
func NewFSValidator(fsys fs.FS, root string) *FSValidator {
|
||||
return &FSValidator{fsys: fsys, root: root}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,11 +250,7 @@ func TestStandardValidatorPreparedSchemaSurvivesSourceRemoval(t *testing.T) {
|
||||
}
|
||||
|
||||
validator := NewStandardValidator(tmp)
|
||||
preparer, ok := validator.(ValidationPreparer)
|
||||
if !ok {
|
||||
t.Fatal("standard validator does not support validation preparation")
|
||||
}
|
||||
prepared, err := preparer.PrepareValidation(context.Background(), domain.OutputContract{
|
||||
prepared, err := validator.PrepareValidation(context.Background(), domain.OutputContract{
|
||||
ValidationMode: domain.ValidationJSONSchema,
|
||||
SchemaPath: "schema.json",
|
||||
})
|
||||
@@ -432,11 +428,7 @@ func TestFSValidatorPreparedSchemaSurvivesSourceMutation(t *testing.T) {
|
||||
}`)},
|
||||
}
|
||||
validator := NewFSValidator(fsys, ".")
|
||||
preparer, ok := validator.(ValidationPreparer)
|
||||
if !ok {
|
||||
t.Fatal("filesystem validator does not support validation preparation")
|
||||
}
|
||||
prepared, err := preparer.PrepareValidation(context.Background(), domain.OutputContract{
|
||||
prepared, err := validator.PrepareValidation(context.Background(), domain.OutputContract{
|
||||
ValidationMode: domain.ValidationJSONSchema,
|
||||
SchemaPath: "schema.json",
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user