fix: Split annotations/main.go in 2 files

This commit is contained in:
Ilya Kuznetsov 2025-01-15 16:26:19 +01:00
parent c74ab7566f
commit 1b73105457
No known key found for this signature in database
GPG Key ID: 91F3DDCF5D21CDDF
2 changed files with 17 additions and 17 deletions

View File

@ -0,0 +1,12 @@
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"`
}
const Placeholder = "PLACEHOLDER"

View File

@ -10,21 +10,11 @@ import (
"github.com/databricks/cli/libs/dyn/yamlloader" "github.com/databricks/cli/libs/dyn/yamlloader"
) )
type Descriptor struct { // Parsed file with annotations, expected format:
Description string `json:"description,omitempty"` // github.com/databricks/cli/bundle/config.Bundle:
MarkdownDescription string `json:"markdown_description,omitempty"` //
Title string `json:"title,omitempty"` // cluster_id:
Default any `json:"default,omitempty"` // description: "Description"
Enum []any `json:"enum,omitempty"`
MarkdownExamples string `json:"markdown_examples,omitempty"`
}
/**
* Parsed file with annotations, expected format:
* github.com/databricks/cli/bundle/config.Bundle:
* cluster_id:
* description: "Description"
*/
type File map[string]map[string]Descriptor type File map[string]map[string]Descriptor
func LoadAndMerge(sources []string) (File, error) { func LoadAndMerge(sources []string) (File, error) {
@ -52,5 +42,3 @@ func LoadAndMerge(sources []string) (File, error) {
} }
return data, nil return data, nil
} }
const Placeholder = "PLACEHOLDER"