databricks-cli/libs/template
shreyas-goenka 1a7bf4e4f1
Add schema and config validation to jsonschema package (#740)
## Changes

At a high level this PR adds new schema validation and moves
functionality that should be present in the jsonschema package, but
resides in the template package today, to the jsonschema package. This
includes for example schema validation, schema instance validation, to /
from string conversion methods etc.

The list below outlines all the pieces that have been moved over, and
the new validation bits added.

This PR:
1. Adds casting default value of schema properties to integers to the
jsonschema.Load method.
2. Adds validation for default value types for schema properties,
checking they are consistant with the type defined.
3. Introduces the LoadInstance and ValidateInstance methods to the json
schema package. These methods can be used to read and validate JSON
documents against the schema.
4. Replaces validation done for template inputs to use the newly defined
JSON schema validation functions.
5. Moves to/from string and isInteger utility methods to the json schema
package.

## Tests
Existing and new unit tests.
2023-09-07 14:36:06 +00:00
..
templates/default-python Fix notebook showing up in template when not selected (#743) 2023-09-07 08:26:43 +00:00
testdata Add schema and config validation to jsonschema package (#740) 2023-09-07 14:36:06 +00:00
config.go Add schema and config validation to jsonschema package (#740) 2023-09-07 14:36:06 +00:00
config_test.go Add schema and config validation to jsonschema package (#740) 2023-09-07 14:36:06 +00:00
file.go Only treat files with .tmpl extension as templates (#594) 2023-08-01 13:43:27 +00:00
file_test.go Only treat files with .tmpl extension as templates (#594) 2023-08-01 13:43:27 +00:00
helpers.go databricks bundle init template v2: optional stubs, DLT support (#700) 2023-09-06 09:52:31 +00:00
helpers_test.go Add a foundation for built-in templates (#685) 2023-08-25 09:03:42 +00:00
materialize.go Cleanup after "Add a foundation for built-in templates" (#707) 2023-08-30 14:01:08 +00:00
renderer.go databricks bundle init template v2: optional stubs, DLT support (#700) 2023-09-06 09:52:31 +00:00
renderer_test.go databricks bundle init template v2: optional stubs, DLT support (#700) 2023-09-06 09:52:31 +00:00