diff --git a/cmd/markdown.go b/cmd/markdown.go index ff16a12..7b20b94 100644 --- a/cmd/markdown.go +++ b/cmd/markdown.go @@ -10,8 +10,12 @@ var outputFileName string // NewCmdMarkdown drives the markdown command for x-docs func NewCmdMarkdown() *cobra.Command { cmd := &cobra.Command{ - Use: "markdown [PATH]", - Short: "Generates markdown based docs for Crossplane resources", + Use: "markdown [PATH]", + Short: "Generates markdown based docs for Crossplane resources", + Example: ` +# Move to the directory which has XRDs & Compositions +crossplane-docs markdown ./samples -o samples/README.md +`, Aliases: []string{"md"}, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/root.go b/cmd/root.go index 0036d60..3957fc1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,8 +6,8 @@ import "github.com/spf13/cobra" func NewCmdRoot() *cobra.Command { cmd := &cobra.Command{ Use: "crossplane-docs", - Aliases: []string{"x-docs"}, Short: "crossplane-docs - Docs generator for your crossplane resources", + Version: "0.1.0", RunE: func(c *cobra.Command, args []string) error { if err := c.Help(); err != nil { return err diff --git a/pkg/markdown.go b/pkg/markdown.go index ac45dd7..f91fd97 100644 --- a/pkg/markdown.go +++ b/pkg/markdown.go @@ -102,6 +102,7 @@ func getXRDSpecData(schema extv1.JSONSchemaProps, xrcOutputData *[]XRDSpecData, Required: slices.Contains(requiredFields, propName), }) if propValue.Properties != nil { + // recursively iterate all the nested properties getXRDSpecData(propValue, xrcOutputData, append(schemaPath, propName), propValue.Required) } } diff --git a/samples/README.md b/samples/README.md index 3617df5..01e7913 100644 --- a/samples/README.md +++ b/samples/README.md @@ -12,9 +12,9 @@ |------|-------|------|-------|-------| | spec | | object | Required spec field for your API | false | | parameters | spec | object | | true | +| storageGB | spec.parameters | integer | size of the Database in GB - integer | true | | dbName | spec.parameters | string | name of the new DB inside the DB instance - string | true | | instanceSize | spec.parameters | string | instance size - string | true | -| storageGB | spec.parameters | integer | size of the Database in GB - integer | true | #### Resources | Name | Kind | API Version | |------|------|-------------|