databricks-cli/cmd/workspace/workspace
Andrew Nester 17ed7a317b
Fixed ignoring required positional parameters when --json flag is provided (#535)
## Changes
When there are positional required parameters in the command which can't
be unmarshalled from JSON, we should require them despite the fact
`--json` flag is provided.

The reason is that for some of the command, for example, `databricks
groups patch ID` these arguments are actually path arguments in API and
can't be set as part of `--json` body provided.

Original change which introduced this ignore logic is here:
https://github.com/databricks/cli/pull/405

Fixes https://github.com/databricks/cli/issues/533,
https://github.com/databricks/cli/issues/537

Note: Code generation is based on the change in this PR:
https://github.com/databricks/databricks-sdk-go/pull/536

## Tests
1. Running `cli groups patch 123 --json {...}` works correctly

Backward compatibility tests with previous changes from
https://github.com/databricks/cli/pull/405
1. `cli clusters events --json '{"cluster_id": "1029-xxxx"}'` - works,
returns list of events
2. `cli clusters events 1029-xxxx` - works, returns list of events
3. `cli clusters events` - works, first prompts for Cluster ID and then
returns the list of events
2023-07-03 13:20:30 +02:00
..
events.go Add workspace import-dir command (#456) 2023-06-12 21:03:46 +02:00
export_dir.go Add workspace export-dir command (#449) 2023-06-08 18:15:12 +02:00
import_dir.go Add workspace import-dir command (#456) 2023-06-12 21:03:46 +02:00
overrides.go Decode contents by default in workspace export command (#531) 2023-06-27 20:42:29 +02:00
workspace.go Fixed ignoring required positional parameters when --json flag is provided (#535) 2023-07-03 13:20:30 +02:00