Skip to content

Commit 93de067

Browse files
committed
Add schemas path parameter to libraryproperties.Validate()
The addition of a schemas path parameter to schema.Validate() necessitates doing the same for this function in order to use it in tests.
1 parent 9d29588 commit 93de067

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: check/checkdata/library.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package checkdata
1717

1818
import (
19+
"github.com/arduino/arduino-check/configuration"
1920
"github.com/arduino/arduino-check/project"
2021
"github.com/arduino/arduino-check/project/library/libraryproperties"
2122
"github.com/arduino/go-properties-orderedmap"
@@ -29,7 +30,7 @@ func InitializeForLibrary(project project.Type) {
2930
// TODO: can I even do this?
3031
libraryPropertiesSchemaValidationResult = nil
3132
} else {
32-
libraryPropertiesSchemaValidationResult = libraryproperties.Validate(libraryProperties)
33+
libraryPropertiesSchemaValidationResult = libraryproperties.Validate(libraryProperties, configuration.SchemasPath())
3334
}
3435
}
3536

Diff for: project/library/libraryproperties/libraryproperties.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package libraryproperties
1818

1919
import (
2020
"github.com/arduino/arduino-check/check/checkdata/schema"
21-
"github.com/arduino/arduino-check/configuration"
2221
"github.com/arduino/go-paths-helper"
2322
"github.com/arduino/go-properties-orderedmap"
2423
"github.com/ory/jsonschema/v3"
@@ -34,9 +33,9 @@ func Properties(libraryPath *paths.Path) (*properties.Map, error) {
3433
}
3534

3635
// Validate validates library.properties data against the JSON schema.
37-
func Validate(libraryProperties *properties.Map) *jsonschema.ValidationError {
36+
func Validate(libraryProperties *properties.Map, schemasPath *paths.Path) *jsonschema.ValidationError {
3837
referencedSchemaFilenames := []string{}
39-
schemaObject := schema.Compile("arduino-library-properties-schema.json", referencedSchemaFilenames, configuration.SchemasPath())
38+
schemaObject := schema.Compile("arduino-library-properties-schema.json", referencedSchemaFilenames, schemasPath)
4039

41-
return schema.Validate(libraryProperties, schemaObject, configuration.SchemasPath())
40+
return schema.Validate(libraryProperties, schemaObject, schemasPath)
4241
}

0 commit comments

Comments
 (0)