From 1dd399f3fe3a71acde7c19f02d016ca2fc7d473c Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Fri, 6 Sep 2024 15:18:31 +0200 Subject: [PATCH] new line for s --- bundle/internal/schema/main.go | 13 ++++++++----- bundle/{generated => schema}/embed.go | 4 ++-- bundle/{generated => schema}/jsonschema.json | 0 cmd/bundle/schema.go | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) rename bundle/{generated => schema}/embed.go (52%) rename bundle/{generated => schema}/jsonschema.json (100%) diff --git a/bundle/internal/schema/main.go b/bundle/internal/schema/main.go index 7750c15ee8..5a6ef7f248 100644 --- a/bundle/internal/schema/main.go +++ b/bundle/internal/schema/main.go @@ -25,16 +25,19 @@ func addInterpolationPatterns(typ reflect.Type, s jsonschema.Schema) jsonschema. case jsonschema.ArrayType, jsonschema.ObjectType: // arrays and objects can have complex variable values specified. return jsonschema.Schema{ - AnyOf: []jsonschema.Schema{s, { - Type: jsonschema.StringType, - Pattern: interpolationPattern("var"), - }}, + AnyOf: []jsonschema.Schema{ + s, + { + Type: jsonschema.StringType, + Pattern: interpolationPattern("var"), + }}, } case jsonschema.IntegerType, jsonschema.NumberType, jsonschema.BooleanType: // primitives can have variable values, or references like ${bundle.xyz} // or ${workspace.xyz} return jsonschema.Schema{ - AnyOf: []jsonschema.Schema{s, + AnyOf: []jsonschema.Schema{ + s, {Type: jsonschema.StringType, Pattern: interpolationPattern("resources")}, {Type: jsonschema.StringType, Pattern: interpolationPattern("bundle")}, {Type: jsonschema.StringType, Pattern: interpolationPattern("workspace")}, diff --git a/bundle/generated/embed.go b/bundle/schema/embed.go similarity index 52% rename from bundle/generated/embed.go rename to bundle/schema/embed.go index 1e674c630c..68f42a8e5c 100644 --- a/bundle/generated/embed.go +++ b/bundle/schema/embed.go @@ -1,6 +1,6 @@ -package generated +package schema import _ "embed" //go:embed jsonschema.json -var BundleSchema []byte +var Bytes []byte diff --git a/bundle/generated/jsonschema.json b/bundle/schema/jsonschema.json similarity index 100% rename from bundle/generated/jsonschema.json rename to bundle/schema/jsonschema.json diff --git a/cmd/bundle/schema.go b/cmd/bundle/schema.go index 967250ce34..6193f91e34 100644 --- a/cmd/bundle/schema.go +++ b/cmd/bundle/schema.go @@ -3,7 +3,7 @@ package bundle import ( _ "embed" - "github.com/databricks/cli/bundle/generated" + "github.com/databricks/cli/bundle/schema" "github.com/databricks/cli/cmd/root" "github.com/spf13/cobra" ) @@ -16,7 +16,7 @@ func newSchemaCommand() *cobra.Command { } cmd.RunE = func(cmd *cobra.Command, args []string) error { - _, err := cmd.OutOrStdout().Write(generated.BundleSchema) + _, err := cmd.OutOrStdout().Write(schema.Bytes) return err }