diff --git a/cmd/gendocs/main.go b/cmd/gendocs/main.go index 6c54ea8..e5f7558 100644 --- a/cmd/gendocs/main.go +++ b/cmd/gendocs/main.go @@ -22,6 +22,7 @@ import ( "github.com/dacolabs/cli/internal/translate/databrickssql" "github.com/dacolabs/cli/internal/translate/dqxyaml" "github.com/dacolabs/cli/internal/translate/gotypes" + "github.com/dacolabs/cli/internal/translate/markdown" "github.com/dacolabs/cli/internal/translate/protobuf" "github.com/dacolabs/cli/internal/translate/pydantic" "github.com/dacolabs/cli/internal/translate/pyspark" @@ -52,6 +53,7 @@ func main() { translators["protobuf"] = &protobuf.Translator{} translators["spark-sql"] = &sparksql.Translator{} translators["dqx-yaml"] = &dqxyaml.Translator{} + translators["markdown"] = &markdown.Translator{} rootCmd := commands.NewRootCmd(translators) rootCmd.DisableAutoGenTag = true diff --git a/daco.yaml b/daco.yaml new file mode 100644 index 0000000..f573a82 --- /dev/null +++ b/daco.yaml @@ -0,0 +1,2 @@ +version: 1 +path: ./spec diff --git a/docs/cli/daco_connections_describe.md b/docs/cli/daco_connections_describe.md index 559e083..b8d8e82 100644 --- a/docs/cli/daco_connections_describe.md +++ b/docs/cli/daco_connections_describe.md @@ -18,19 +18,12 @@ daco connections describe [CONNECTION_NAME] [flags] # Show connection details daco connections describe kafka_prod - - # Show as JSON - daco connections describe kafka_prod -o json - - # Show as YAML - daco connections describe kafka_prod -o yaml ``` ### Options ``` - -h, --help help for describe - -o, --output string Output format (text, json, yaml) (default "text") + -h, --help help for describe ``` ### SEE ALSO diff --git a/docs/cli/daco_connections_list.md b/docs/cli/daco_connections_list.md index 26b4bf6..4c394bd 100644 --- a/docs/cli/daco_connections_list.md +++ b/docs/cli/daco_connections_list.md @@ -13,21 +13,14 @@ daco connections list [flags] ### Examples ``` - # List connections in table format + # List connections daco connections list - - # List connections as JSON - daco connections list -o json - - # List connections as YAML - daco connections list -o yaml ``` ### Options ``` - -h, --help help for list - -o, --output string Output format (table, json, yaml) (default "table") + -h, --help help for list ``` ### SEE ALSO diff --git a/docs/cli/daco_describe.md b/docs/cli/daco_describe.md new file mode 100644 index 0000000..bcedf40 --- /dev/null +++ b/docs/cli/daco_describe.md @@ -0,0 +1,30 @@ +## daco describe + +Show data product overview with ports and connections + +### Synopsis + +Show a summary of the data product including its metadata, +all defined ports, and all defined connections. + +``` +daco describe [flags] +``` + +### Examples + +``` + # Describe the data product + daco describe +``` + +### Options + +``` + -h, --help help for describe +``` + +### SEE ALSO + +* [daco](daco.md) - Data product CLI tool + diff --git a/docs/cli/daco_ports_describe.md b/docs/cli/daco_ports_describe.md index 7972e7e..99f7a0e 100644 --- a/docs/cli/daco_ports_describe.md +++ b/docs/cli/daco_ports_describe.md @@ -16,21 +16,14 @@ daco ports describe [PORT_NAME] [flags] # Interactive selection daco ports describe - # Show port details in human-readable format + # Show port details daco ports describe user_events - - # Show port details as JSON - daco ports describe user_events -o json - - # Show port details as YAML - daco ports describe user_events -o yaml ``` ### Options ``` - -h, --help help for describe - -o, --output string Output format (text, json, yaml) (default "text") + -h, --help help for describe ``` ### SEE ALSO diff --git a/docs/cli/daco_ports_list.md b/docs/cli/daco_ports_list.md index c2c120c..c2d2a3d 100644 --- a/docs/cli/daco_ports_list.md +++ b/docs/cli/daco_ports_list.md @@ -14,21 +14,14 @@ daco ports list [flags] ### Examples ``` - # List ports in table format + # List ports daco ports list - - # List ports as JSON - daco ports list -o json - - # List ports as YAML - daco ports list -o yaml ``` ### Options ``` - -h, --help help for list - -o, --output string Output format (table, json, yaml) (default "table") + -h, --help help for list ``` ### SEE ALSO diff --git a/docs/cli/daco_ports_translate.md b/docs/cli/daco_ports_translate.md index e402835..8557665 100644 --- a/docs/cli/daco_ports_translate.md +++ b/docs/cli/daco_ports_translate.md @@ -6,7 +6,7 @@ Translate a port schema to a target format Translate a port schema to a target format. -Available formats: databricks-pyspark, pydantic, python, databricks-sql, scala, protobuf, pyspark, avro, spark-scala, databricks-scala, spark-sql, gotypes +Available formats: spark-scala, dqx-yaml, pyspark, avro, pydantic, python, databricks-sql, protobuf, gotypes, databricks-pyspark, scala, databricks-scala, spark-sql, markdown ``` daco ports translate [flags] @@ -19,20 +19,26 @@ daco ports translate [flags] daco ports translate # Translate specific port - daco ports translate --name my-port --format pyspark --output schema.py + daco ports translate --name my-port --format pyspark - # Translate to a custom directory (also sets package name for Go/Protobuf/Scala) - daco ports translate --format gotypes --output-dir models + # Translate multiple ports + daco ports translate --name port-a,port-b --format pyspark + + # Translate all ports + daco ports translate --all --format pyspark + + # Translate to a custom output directory (also sets package name for Go/Protobuf/Scala) + daco ports translate --all --format gotypes --output models ``` ### Options ``` - -f, --format string Output format (pyspark, avro, spark-scala, databricks-scala, spark-sql, gotypes, databricks-pyspark, pydantic, python, databricks-sql, scala, protobuf) - -h, --help help for translate - -n, --name string Port name (translates all if not specified) - -o, --output string Output file path (only valid when translating a single port) - -d, --output-dir string Output directory (also used as package name for Go/Protobuf/Scala) (default "schemas") + -a, --all Translate all ports + --format string Output format (spark-scala, dqx-yaml, pyspark, avro, pydantic, python, databricks-sql, protobuf, gotypes, databricks-pyspark, scala, databricks-scala, spark-sql, markdown) + -h, --help help for translate + -n, --name string Port name(s), comma-separated + -o, --output string Output directory (also used as package name for Go/Protobuf/Scala) (default "schemas") ``` ### SEE ALSO diff --git a/docs/cli/daco_product.md b/docs/cli/daco_product.md new file mode 100644 index 0000000..4da11dd --- /dev/null +++ b/docs/cli/daco_product.md @@ -0,0 +1,21 @@ +## daco product + +Manage data product metadata + +### Synopsis + +Manage data product metadata defined in the OpenDPI spec. +Use subcommands to view or upgrade the product version. + +### Options + +``` + -h, --help help for product +``` + +### SEE ALSO + +* [daco](daco.md) - Data product CLI tool +* [daco product upgrade](daco_product_upgrade.md) - Upgrade the data product version +* [daco product version](daco_product_version.md) - Show the data product spec version + diff --git a/docs/cli/daco_product_upgrade.md b/docs/cli/daco_product_upgrade.md new file mode 100644 index 0000000..af7ac41 --- /dev/null +++ b/docs/cli/daco_product_upgrade.md @@ -0,0 +1,34 @@ +## daco product upgrade + +Upgrade the data product version + +### Synopsis + +Upgrade the data product version by bumping major, minor, or patch. +In interactive mode, a form is shown to select the bump type. + +``` +daco product upgrade [flags] +``` + +### Examples + +``` + # Interactive mode + daco product upgrade + + # Non-interactive + daco product upgrade --bump minor +``` + +### Options + +``` + -b, --bump string Bump type: major, minor, or patch + -h, --help help for upgrade +``` + +### SEE ALSO + +* [daco product](daco_product.md) - Manage data product metadata + diff --git a/docs/cli/daco_product_version.md b/docs/cli/daco_product_version.md new file mode 100644 index 0000000..3f16ff8 --- /dev/null +++ b/docs/cli/daco_product_version.md @@ -0,0 +1,29 @@ +## daco product version + +Show the data product spec version + +### Synopsis + +Show the current version of the data product as defined in the OpenDPI spec. + +``` +daco product version [flags] +``` + +### Examples + +``` + # Show the product version + daco product version +``` + +### Options + +``` + -h, --help help for version +``` + +### SEE ALSO + +* [daco product](daco_product.md) - Manage data product metadata + diff --git a/docs/cli/index.md b/docs/cli/index.md index b1813cd..2b41fca 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -18,5 +18,8 @@ Avro, Protobuf, Go types, and more. ### SEE ALSO * [daco connections](daco_connections.md) - Manage data product connections +* [daco describe](daco_describe.md) - Show data product overview with ports and connections * [daco init](daco_init.md) - Initialize a new daco project -* [daco ports](daco_ports.md) - Manage data product ports \ No newline at end of file +* [daco ports](daco_ports.md) - Manage data product ports +* [daco product](daco_product.md) - Manage data product metadata + diff --git a/schemas/myport.md b/schemas/myport.md new file mode 100644 index 0000000..3aaf846 --- /dev/null +++ b/schemas/myport.md @@ -0,0 +1,39 @@ +# Myport + +## Fields + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `name` | string | Yes | | +| `metadata` | [Metadata](#Metadata) | Yes | | +| `spec` | [Spec](#Spec) | Yes | | + + +--- + +## Metadata + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `owner` | string | Yes | | +| `environment` | string | No | (enum: `prod`, `staging`, `dev`) | + + +--- + +## Fields + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `name` | string | Yes | | +| `type` | string | Yes | (enum: `string`, `integer`, `boolean`, `float`) | + + +--- + +## Spec + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `fields` | array([Fields](#Fields)) | No | | + diff --git a/spec/opendpi.yaml b/spec/opendpi.yaml new file mode 100644 index 0000000..51d54a4 --- /dev/null +++ b/spec/opendpi.yaml @@ -0,0 +1,10 @@ +opendpi: 1.0.0 +info: + title: myproduct + version: 1.0.0 +connections: {} +ports: + myport: + connections: [] + schema: + $ref: schemas/myport.schema.yaml diff --git a/spec/schemas/myport.schema.yaml b/spec/schemas/myport.schema.yaml new file mode 100644 index 0000000..3a2d258 --- /dev/null +++ b/spec/schemas/myport.schema.yaml @@ -0,0 +1,39 @@ +type: object +properties: + name: + type: "string" + + # Nested Object: Metadata + metadata: + type: "object" + properties: + owner: + type: "string" + environment: + type: "string" + enum: ["prod", "staging", "dev"] + required: + - "owner" + + # Nested Array of Objects: Columns/Fields + spec: + type: "object" + properties: + fields: + type: "array" + items: + type: "object" + properties: + name: + type: "string" + type: + type: "string" + enum: ["string", "integer", "boolean", "float"] + required: + - "name" + - "type" + +required: + - "name" + - "metadata" + - "spec" \ No newline at end of file