databricks-cli/libs/dyn/convert
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
..
end_to_end_test.go Fix conversion of zero valued scalar pointers to a dynamic value (#1433) 2024-05-21 11:53:00 +00:00
error.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
from_typed.go Track multiple locations associated with a `dyn.Value` (#1510) 2024-07-16 11:27:27 +00:00
from_typed_test.go Track multiple locations associated with a `dyn.Value` (#1510) 2024-07-16 11:27:27 +00:00
normalize.go Add `dyn.Time` to box a timestamp with its original string value (#1732) 2024-08-29 13:02:34 +00:00
normalize_test.go Add `dyn.Time` to box a timestamp with its original string value (#1732) 2024-08-29 13:02:34 +00:00
struct_info.go Add support for Lakehouse monitoring in bundles (#1307) 2024-05-31 09:42:25 +00:00
struct_info_test.go Define `dyn.Mapping` to represent maps (#1301) 2024-03-25 11:01:09 +00:00
to_typed.go Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
to_typed_test.go Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00