@@ -6,6 +6,10 @@ import (
66 "github.com/stackql/any-sdk/pkg/docval"
77)
88
9+ var (
10+ validator docval.FileValidator = docval .NewFileValidator ("testdata/schema-definitions" )
11+ )
12+
913func TestValidateAndParse_ValidJSON (t * testing.T ) {
1014 jsonDoc := []byte (`{"name": "Alice", "age": 30}` )
1115 jsonSchema := []byte (`{
@@ -27,7 +31,7 @@ func TestValidateAndParse_ValidJSON(t *testing.T) {
2731}
2832
2933func TestLocalValidateAndParseValidProviderFile (t * testing.T ) {
30- rv , err := docval .ValidateAndParseFile ("testdata/docs/local_openssl/v0.1.0/provider.yaml" , "testdata/schema-definitions/ provider.schema.json" )
34+ rv , err := validator .ValidateAndParseFile ("testdata/docs/local_openssl/v0.1.0/provider.yaml" , "provider.schema.json" )
3135 if err != nil {
3236 t .Fatalf ("expected no error, got %v" , err )
3337 }
@@ -37,7 +41,7 @@ func TestLocalValidateAndParseValidProviderFile(t *testing.T) {
3741}
3842
3943func TestValidateAndParseGoogleProviderFile (t * testing.T ) {
40- rv , err := docval .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/provider.yaml" , "testdata/schema-definitions/ provider.schema.json" )
44+ rv , err := validator .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/provider.yaml" , "provider.schema.json" )
4145 if err == nil {
4246 t .Fatalf ("expected an error, got none" )
4347 }
@@ -47,7 +51,7 @@ func TestValidateAndParseGoogleProviderFile(t *testing.T) {
4751}
4852
4953func TestFragmentedResourcesFile (t * testing.T ) {
50- rv , err := docval .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/resources/compute-v1.yaml" , "testdata/schema-definitions/ fragmented-resources.schema.json" )
54+ rv , err := validator .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/resources/compute-v1.yaml" , "fragmented-resources.schema.json" )
5155 if err != nil {
5256 t .Fatalf ("expected no error, got %v" , err )
5357 }
@@ -61,7 +65,7 @@ func TestFragmentedResourcesFile(t *testing.T) {
6165}
6266
6367func TestMonolithicCompositeServiceFile (t * testing.T ) {
64- rv , err := docval .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/services/bigquery-v2.yaml" , "testdata/schema-definitions/ service-resources.schema.json" )
68+ rv , err := validator .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/services/bigquery-v2.yaml" , "service-resources.schema.json" )
6569 if err != nil {
6670 t .Fatalf ("expected no error, got %v" , err )
6771 }
@@ -71,7 +75,7 @@ func TestMonolithicCompositeServiceFile(t *testing.T) {
7175}
7276
7377func TestSplitCompositeServiceFile (t * testing.T ) {
74- rv , err := docval .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/services-split/compute/compute-disks-v1.yaml" , "testdata/schema-definitions/ service-resources.schema.json" )
78+ rv , err := validator .ValidateAndParseFile ("testdata/docs/googleapis.com/v0.1.2/services-split/compute/compute-disks-v1.yaml" , "service-resources.schema.json" )
7579 if err != nil {
7680 t .Fatalf ("expected no error, got %v" , err )
7781 }
@@ -81,7 +85,7 @@ func TestSplitCompositeServiceFile(t *testing.T) {
8185}
8286
8387func TestLocalTemplatedCompositeServiceFile (t * testing.T ) {
84- rv , err := docval .ValidateAndParseFile ("testdata/docs/local_openssl/v0.1.0/services/keys.yaml" , "testdata/schema-definitions/ local-templated.service-resources.schema.json" )
88+ rv , err := validator .ValidateAndParseFile ("testdata/docs/local_openssl/v0.1.0/services/keys.yaml" , "local-templated.service-resources.schema.json" )
8589 if err != nil {
8690 t .Fatalf ("expected no error, got %v" , err )
8791 }
0 commit comments