From ad81e1f0afe49977d69630e4441ff4a0c06bf1c0 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Mon, 13 Jan 2025 15:16:47 +0100 Subject: [PATCH] fix: Few links updates --- bundle/internal/docs/markdown.go | 8 +++++++- bundle/internal/docs/nodes.go | 3 +-- bundle/internal/schema/annotations.yml | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/bundle/internal/docs/markdown.go b/bundle/internal/docs/markdown.go index 508f63578..acc098aaf 100644 --- a/bundle/internal/docs/markdown.go +++ b/bundle/internal/docs/markdown.go @@ -123,7 +123,8 @@ func buildMarkdown(nodes []rootNode, outputFile, header string) error { m = m.LF() if len(node.ObjectKeyAttributes) > 0 { - n := removePluralForm(node.Title) + n := pickLastWord(node.Title) + n = removePluralForm(n) m = m.CodeBlocks("yaml", fmt.Sprintf("%ss:\n <%s-name>:\n <%s-field-name>: <%s-field-value>", n, n, n, n)) m = m.LF() m = buildAttributeTable(m, node.ObjectKeyAttributes) @@ -151,6 +152,11 @@ func buildMarkdown(nodes []rootNode, outputFile, header string) error { return nil } +func pickLastWord(s string) string { + words := strings.Split(s, ".") + return words[len(words)-1] +} + // Build a custom table which we use in Databricks website func buildCustomAttributeTable(m *md.Markdown, attributes []attributeNode) *md.Markdown { m = m.LF() diff --git a/bundle/internal/docs/nodes.go b/bundle/internal/docs/nodes.go index ae8fa9efd..2c9626d15 100644 --- a/bundle/internal/docs/nodes.go +++ b/bundle/internal/docs/nodes.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "sort" "strings" @@ -73,7 +72,7 @@ func getNodes(s jsonschema.Schema, refs map[string]jsonschema.Schema, customFiel if len(node.Example) == 0 { node.Example = getExample(objectKeyType) } - prefix := fmt.Sprintf("%s.<%s-name>", k, removePluralForm(k)) + prefix := k + "." node.ObjectKeyAttributes = getAttributes(objectKeyType.Properties, refs, customFields, prefix) rootProps = append(rootProps, extractNodes(prefix, objectKeyType.Properties, refs, customFields)...) } diff --git a/bundle/internal/schema/annotations.yml b/bundle/internal/schema/annotations.yml index 6b5d873b3..5427ba886 100644 --- a/bundle/internal/schema/annotations.yml +++ b/bundle/internal/schema/annotations.yml @@ -143,57 +143,57 @@ github.com/databricks/cli/bundle/config.Resources: "description": |- The cluster definitions for the bundle, where each key is the name of a cluster. "markdown_description": |- - The cluster definitions for the bundle, where each key is the name of a cluster. See [_](/dev-tools/bundles/resources.md#cluster) + The cluster definitions for the bundle, where each key is the name of a cluster. See [_](/dev-tools/bundles/resources.md#clusters) "dashboards": "description": |- The dashboard definitions for the bundle, where each key is the name of the dashboard. "markdown_description": |- - The dashboard definitions for the bundle, where each key is the name of the dashboard. See [_](/dev-tools/bundles/resources.md#dashboard) + The dashboard definitions for the bundle, where each key is the name of the dashboard. See [_](/dev-tools/bundles/resources.md#dashboards) "experiments": "description": |- The experiment definitions for the bundle, where each key is the name of the experiment. "markdown_description": |- - The experiment definitions for the bundle, where each key is the name of the experiment. See [_](/dev-tools/bundles/resources.md#experiment) + The experiment definitions for the bundle, where each key is the name of the experiment. See [_](/dev-tools/bundles/resources.md#experiments) "jobs": "description": |- The job definitions for the bundle, where each key is the name of the job. "markdown_description": |- - The job definitions for the bundle, where each key is the name of the job. See [_](/dev-tools/bundles/resources.md#job) + The job definitions for the bundle, where each key is the name of the job. See [_](/dev-tools/bundles/resources.md#jobs) "model_serving_endpoints": "description": |- The model serving endpoint definitions for the bundle, where each key is the name of the model serving endpoint. "markdown_description": |- - The model serving endpoint definitions for the bundle, where each key is the name of the model serving endpoint. See [_](/dev-tools/bundles/resources.md#model_serving_endpoint) + The model serving endpoint definitions for the bundle, where each key is the name of the model serving endpoint. See [_](/dev-tools/bundles/resources.md#model_serving_endpoints) "models": "description": |- The model definitions for the bundle, where each key is the name of the model. "markdown_description": |- - The model definitions for the bundle, where each key is the name of the model. See [_](/dev-tools/bundles/resources.md#model-legacy) + The model definitions for the bundle, where each key is the name of the model. See [_](/dev-tools/bundles/resources.md#models) "pipelines": "description": |- The pipeline definitions for the bundle, where each key is the name of the pipeline. "markdown_description": |- - The pipeline definitions for the bundle, where each key is the name of the pipeline. See [_](/dev-tools/bundles/resources.md#pipeline) + The pipeline definitions for the bundle, where each key is the name of the pipeline. See [_](/dev-tools/bundles/resources.md#pipelines) "quality_monitors": "description": |- The quality monitor definitions for the bundle, where each key is the name of the quality monitor. "markdown_description": |- - The quality monitor definitions for the bundle, where each key is the name of the quality monitor. See [_](/dev-tools/bundles/resources.md#quality-monitor) + The quality monitor definitions for the bundle, where each key is the name of the quality monitor. See [_](/dev-tools/bundles/resources.md#quality_monitors) "registered_models": "description": |- The registered model definitions for the bundle, where each key is the name of the registered model. "markdown_description": |- - The registered model definitions for the bundle, where each key is the name of the registered model. See [_](/dev-tools/bundles/resources.md#registered-model) + The registered model definitions for the bundle, where each key is the name of the registered model. See [_](/dev-tools/bundles/resources.md#registered_models) "schemas": "description": |- The schema definitions for the bundle, where each key is the name of the schema. "markdown_description": |- - The schema definitions for the bundle, where each key is the name of the schema. See [_](/dev-tools/bundles/resources.md#schema) + The schema definitions for the bundle, where each key is the name of the schema. See [_](/dev-tools/bundles/resources.md#schemas) "volumes": "description": |- The volume definitions for the bundle, where each key is the name of the volume. "markdown_description": |- - The volume definitions for the bundle, where each key is the name of the volume. See [_](/dev-tools/bundles/resources.md#volume) + The volume definitions for the bundle, where each key is the name of the volume. See [_](/dev-tools/bundles/resources.md#volumes) github.com/databricks/cli/bundle/config.Root: "artifacts": "description": |- @@ -253,7 +253,7 @@ github.com/databricks/cli/bundle/config.Root: ```yaml resources: - s: + : : : ```