Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure required options are only enforced for relevant subcommands in…
… SDK (#231) * Move schema validation right on the first usage of `v` * Fix sub-test * Add unit test that reproduces the bug * Set normal flags instead of persistent ones Persistent flags work for *all* sub-commands, so if they are set as needed, then they will be needed by any subcommand * Fix check in unit test * Rename test and add 2 test cases * Visit and set the flags for some subcommands * Add new field Persistent * Make all default fields persistent * Visit persistent flags and set their value from Viper * Make relationships from default fields public * Don't combine default/persistent fields with developer provided ones We don't want all fields to be persistent, meaning, to be defined as if they were defined for all subcommands. Connectors will define required fields, and making these persistent means that they will be required in every subcommand, even in those that they make no sense like `help` or `completions`. So, anyway, this also implied some changes in design, like not mixing fields defined by the developer of the connector. The reason for this is that right now those fields that are persistent are the default ones brought by the SDK, and Cobra has problems making relationships between fields if some of them are defined on the subcommand while others are not. Besides, only the main command should get defined those fields that are persistent. * Make function to define persistent fields only * Add test case * Be specific about the error for a test case * Allow for persistent and non-persistent flags in connector configuration * Delete rendundant function advice from @CodeRabbit 🤷
- Loading branch information