Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e500f48
Drive CLI codegen from a checked-in cli.json
pietern Jun 9, 2026
d5673ef
internal/cligen: test splitASCII name-splitting behavior
pietern Jun 9, 2026
e54bc98
internal/cligen: move splitASCII into split.go
pietern Jun 9, 2026
b47043d
internal/cligen: reword split.go header comment
pietern Jun 9, 2026
078472c
internal/cligen: cover the empty/underscore/$ guard branches
pietern Jun 9, 2026
33fe412
codegen: consume the IR-derived cli.json from genkit
pietern Jun 9, 2026
bddbd3c
bundle/internal/schema: drop dead mapIncorrectTypNames
pietern Jun 9, 2026
ea21ed6
Taskfile: minimize diff vs origin/main
pietern Jun 9, 2026
6140ac3
Surface field launch stage in the bundle schema from cli.json
janniklasrose Jun 10, 2026
e69435c
Point VS Code at the local bundle schema for databricks.yml
janniklasrose Jun 10, 2026
e6b64cd
Move PreviewTagShort to the annotation package
janniklasrose Jun 10, 2026
4d3245f
Merge origin/main into sdk-field-status-in-schema
janniklasrose Jun 11, 2026
34ac637
Spell out preview tags in enum value labels too
janniklasrose Jun 11, 2026
4d154e4
Restore python/uv.lock to main's version
janniklasrose Jun 11, 2026
1e1d8e7
Stop emitting raw x-databricks-launch-stage in the published schemas
janniklasrose Jun 11, 2026
7ca85f7
Merge remote-tracking branch 'origin/main' into sdk-field-status-in-s…
janniklasrose Jun 12, 2026
dbedf1c
Merge origin/main into sdk-field-status-in-schema
janniklasrose Jun 12, 2026
6d3a8e4
Update comments in preview.go for clarity
janniklasrose Jun 12, 2026
102150d
Remove bundle.yml from vscode settings file
janniklasrose Jun 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,11 @@
"script": "shellscript",
"script.prepare": "shellscript",
"script.cleanup": "shellscript"
},
"yaml.schemas": {
"./bundle/schema/jsonschema.json": [
"databricks.yml",
"databricks.yaml",
]
}
}
21 changes: 12 additions & 9 deletions bundle/internal/annotation/descriptor.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package annotation

type Descriptor struct {
Description string `json:"description,omitempty"`
MarkdownDescription string `json:"markdown_description,omitempty"`
Title string `json:"title,omitempty"`
Default any `json:"default,omitempty"`
Enum []any `json:"enum,omitempty"`
MarkdownExamples string `json:"markdown_examples,omitempty"`
DeprecationMessage string `json:"deprecation_message,omitempty"`
Preview string `json:"x-databricks-preview,omitempty"`
OutputOnly *bool `json:"x-databricks-field-behaviors_output_only,omitempty"`
Description string `json:"description,omitempty"`
MarkdownDescription string `json:"markdown_description,omitempty"`
Title string `json:"title,omitempty"`
Default any `json:"default,omitempty"`
Enum []any `json:"enum,omitempty"`
MarkdownExamples string `json:"markdown_examples,omitempty"`
DeprecationMessage string `json:"deprecation_message,omitempty"`
Preview string `json:"x-databricks-preview,omitempty"`
LaunchStage string `json:"x-databricks-launch-stage,omitempty"`
EnumLaunchStages map[string]string `json:"x-databricks-enum-launch-stages,omitempty"`
EnumDescriptions map[string]string `json:"x-databricks-enum-descriptions,omitempty"`
OutputOnly *bool `json:"x-databricks-field-behaviors_output_only,omitempty"`
}

const Placeholder = "PLACEHOLDER"
15 changes: 15 additions & 0 deletions bundle/internal/annotation/preview.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package annotation

// PreviewTag returns the human-readable launch-stage prefix to prepend to a
// field's or enum value's description. Others are skipped.
func PreviewTag(launchStage string) string {
switch launchStage {
case "PRIVATE_PREVIEW":
return "[Private Preview]"
case "PUBLIC_BETA":
return "[Beta]"
case "PUBLIC_PREVIEW":
return "[Public Preview]"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we had a "LaunchStage" type we can use for this (for ex in internal/clijson/types.go).

Some kind of enforcement or check that if a new stage is added we don't forget to update this mapping.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do as follow-up

return ""
}
25 changes: 25 additions & 0 deletions bundle/internal/annotation/preview_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package annotation_test

import (
"testing"

"github.com/databricks/cli/bundle/internal/annotation"
"github.com/stretchr/testify/assert"
)

func TestPreviewTag(t *testing.T) {
tests := []struct {
launchStage string
want string
}{
{"PUBLIC_PREVIEW", "[Public Preview]"},
{"PUBLIC_BETA", "[Beta]"},
{"PRIVATE_PREVIEW", "[Private Preview]"},
{"GA", ""},
{"", ""},
{"SOMETHING_ELSE", ""},
}
for _, tc := range tests {
assert.Equal(t, tc.want, annotation.PreviewTag(tc.launchStage))
}
}
55 changes: 55 additions & 0 deletions bundle/internal/schema/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ func assignAnnotation(s *jsonschema.Schema, a annotation.Descriptor) {
s.DeprecationMessage = a.DeprecationMessage
}

// The raw launch stage is intentionally not emitted into the published
// schema — nothing consumes it there. It surfaces only as the description
// prefix below and the per-value enumDescriptions labels.
// x-databricks-preview does stay: the parser derives it from launch_stage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field x-databricks-preview exists only as a remnant of previous codegen.

Would be great if we make also downstream codegen use the launch stage exclusively.

Can be a follow up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

// (PRIVATE iff PRIVATE_PREVIEW), and pydabs reads it from jsonschema.json
// to mark fields experimental, so this branch also covers hiding
// private-preview fields.
if a.Preview == "PRIVATE" {
s.DoNotSuggest = true
s.Preview = a.Preview
Expand All @@ -146,6 +153,54 @@ func assignAnnotation(s *jsonschema.Schema, a annotation.Descriptor) {
s.MarkdownDescription = convertLinksToAbsoluteUrl(a.MarkdownDescription)
s.Title = a.Title
s.Enum = a.Enum
s.EnumDescriptions = buildEnumDescriptions(a.Enum, a.EnumLaunchStages, a.EnumDescriptions)

// Surface launch stage in hover tooltips. Editors only render the standard
// description field, so the tag is baked into the text.
if tag := annotation.PreviewTag(a.LaunchStage); tag != "" {
s.Description = prefixWithPreviewTag(s.Description, tag)
}
}

// buildEnumDescriptions produces the parallel enumDescriptions array VSCode
// renders next to each enum value. Each entry combines the launch-stage tag
// and the per-value description text. Returns nil when every entry would be
// empty so the field is omitted from the schema. The enum slice is the same
// one assigned to s.Enum, so the arrays stay index-aligned.
func buildEnumDescriptions(enum []any, launchStages, descriptions map[string]string) []string {
if len(enum) == 0 || (len(launchStages) == 0 && len(descriptions) == 0) {
return nil
}
result := make([]string, len(enum))
hasContent := false
for i, v := range enum {
key, ok := v.(string)
if !ok {
continue
}
result[i] = prefixWithPreviewTag(descriptions[key], annotation.PreviewTag(launchStages[key]))
if result[i] != "" {
hasContent = true
}
}
if !hasContent {
return nil
}
return result
}

// prefixWithPreviewTag prepends the launch-stage tag to a description while
// guarding against double-tagging — if the description already starts with
// the tag, it is returned unchanged. An empty tag (GA) also takes the
// HasPrefix path, returning the description as-is.
func prefixWithPreviewTag(description, tag string) string {
if description == "" {
return tag
}
if strings.HasPrefix(description, tag) {
return description
}
return tag + " " + description
}

func saveYamlWithStyle(outputPath string, annotations annotation.File) error {
Expand Down
Loading
Loading