databricks-cli/cmd
Andrew Nester f0e2981596
Added JSON input validation for CLI commands (#1771)
## Changes
Added JSON input validation for CLI commands. Now when invalid JSON
passed as a payload to CLI commands, CLI performs input normalisation
and detects if there are any mismatches such as incorrect types, unknown
fields and etc.

This diagnostic information is printed in standard error output and does
not block command execution, so the change is backward compatible.

Fixes #1769 #1764 #1625 #1560


## Tests
Added unit tests

```
andrew.nester@HFW9Y94129 ~ % databricks jobs create --json '{"seeti}'
Error: error decoding JSON at (inline):1:2: unexpected EOF


andrew.nester@HFW9Y94129 ~ % databricks jobs create --json '{"seeti": true}'
Warning: unknown field: seeti
  in (inline):1:9

Error: Job settings must be specified.
```

---------

Co-authored-by: Pieter Noordhuis <pieter.noordhuis@databricks.com>
2024-10-11 14:39:53 +00:00
..
account Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
api Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
auth Do not error if we cannot prompt for a profile in `auth login` (#1745) 2024-09-04 07:14:21 +00:00
bundle Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
configure Fix `databricks configure` to use DATABRICKS_CONFIG_FILE environment variable if exists as config file (#1325) 2024-06-24 10:56:49 +00:00
fs Add command line autocomplete to the fs commands (#1622) 2024-08-09 09:40:25 +00:00
labs Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00
root Fix streaming of stdout, stdin, stderr in cobra test runner (#1742) 2024-09-02 13:43:17 +00:00
sync Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
version Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
workspace Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
cmd.go Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00