mirror of https://github.com/databricks/cli.git
bundle schema command is OK now
This commit is contained in:
parent
483480f4a9
commit
727036bb40
|
@ -1,10 +1,15 @@
|
||||||
package bundle
|
package bundle
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
|
|
||||||
"github.com/databricks/cli/cmd/root"
|
"github.com/databricks/cli/cmd/root"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed _generated/jsonschema.json
|
||||||
|
var b []byte
|
||||||
|
|
||||||
func newSchemaCommand() *cobra.Command {
|
func newSchemaCommand() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "schema",
|
Use: "schema",
|
||||||
|
@ -13,34 +18,8 @@ func newSchemaCommand() *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
||||||
// os.ReadFile()
|
_, err := cmd.OutOrStdout().Write(b)
|
||||||
|
return err
|
||||||
// // Load embedded schema descriptions.
|
|
||||||
// docs, err := schema.LoadBundleDescriptions()
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Generate the JSON schema from the bundle configuration struct in Go.
|
|
||||||
// schema, err := schema.New(reflect.TypeOf(config.Root{}), docs)
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Target variable value overrides can be primitives, maps or sequences.
|
|
||||||
// // Set an empty schema for them.
|
|
||||||
// err = schema.SetByPath("targets.*.variables.*", jsonschema.Schema{})
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Print the JSON schema to stdout.
|
|
||||||
// result, err := json.MarshalIndent(schema, "", " ")
|
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
// cmd.OutOrStdout().Write(result)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
Loading…
Reference in New Issue