databricks-cli/libs/jsonschema
shreyas-goenka 3700785dfa
Add support for validating CLI version when loading a jsonschema object (#883)
## Changes
Updates to bundle templates can require updated versions of the CLI.
This PR extends the JSON schema representation to allow template authors
to set a min CLI version they require for their templates.

This is required to make improvements/additions to the mlops-stacks repo

## Tests
Tested using unit tests and manually. 

For manualy testing, I created a custom build of the CLI using go
releaser and then tested it against a local instance of mlops-stack
When mlops-stack schema has:
```
  "min_databricks_cli_version": "v5000.1.1",
```

output (error as expected)
```
shreyas.goenka@THW32HFW6T bricks % ./dist/cli_darwin_arm64/databricks bundle init  ~/mlops-stack
Error: minimum CLI version "v5000.1.1" is greater than current CLI version "v0.207.2-dev+1b992c0". Please upgrade your current Databricks CLI
```

When the mlops-stack schema has:
```
  "min_databricks_cli_version": "v0.1.1",
```

output (validation passes)
```
shreyas.goenka@THW32HFW6T bricks % ./dist/cli_darwin_arm64/databricks bundle init  ~/mlops-stack
Welcome to MLOps Stack. For detailed information on project generation, see the README at https://github.com/databricks/mlops-stack/blob/main/README.md.

Project Name [my-mlops-project]: ^C
```
2023-10-19 14:01:48 +00:00
..
testdata Add support for regex patterns in template schema (#768) 2023-09-25 09:53:38 +00:00
extension.go Add support for validating CLI version when loading a jsonschema object (#883) 2023-10-19 14:01:48 +00:00
instance.go Improve the output of the `databricks bundle init` command (#795) 2023-10-19 07:08:36 +00:00
instance_test.go Add support for regex patterns in template schema (#768) 2023-09-25 09:53:38 +00:00
schema.go Add support for validating CLI version when loading a jsonschema object (#883) 2023-10-19 14:01:48 +00:00
schema_order.go Add support for ordering of input prompts (#662) 2023-09-05 11:08:25 +00:00
schema_order_test.go Add support for ordering of input prompts (#662) 2023-09-05 11:08:25 +00:00
schema_test.go Add support for validating CLI version when loading a jsonschema object (#883) 2023-10-19 14:01:48 +00:00
utils.go Add support for regex patterns in template schema (#768) 2023-09-25 09:53:38 +00:00
utils_test.go Add support for regex patterns in template schema (#768) 2023-09-25 09:53:38 +00:00
validate_type.go Add schema and config validation to jsonschema package (#740) 2023-09-07 14:36:06 +00:00
validate_type_test.go Add schema and config validation to jsonschema package (#740) 2023-09-07 14:36:06 +00:00