diff --git a/hack/platform/util/schema.go b/hack/platform/util/schema.go index fe860e882..125f1951b 100644 --- a/hack/platform/util/schema.go +++ b/hack/platform/util/schema.go @@ -275,44 +275,10 @@ func GenerateObjectOverview(information *ObjectInformation) { }) } - relPath := "" - dir, file := path.Split(information.File) - for file != "api" { - dir, file = path.Split(strings.TrimSuffix(dir, "/")) - if file == "" { - panic("Unsupported path: " + information.File) - } - - if file != "api" { - relPath += "../" - } - } - if relPath == "" { - relPath = "." - } - relPath = strings.TrimSuffix(relPath, "/") - - // write overview - writeTemplate(TemplateObjectOverview, information.File, ObjectOverviewValues{ - Title: information.Title, - Resource: information.Resource, - Description: information.Description, - RelativePath: relPath, - Name: information.Name, - Plural: information.Plural, - YAMLObject: string(out), - - Project: information.Project, - - Create: information.Create, - Retrieve: information.Retrieve, - Update: information.Update, - Delete: information.Delete, - - SubResource: information.SubResource, - SubResourceCreate: information.SubResourceCreate, - SubResourceGet: information.SubResourceGet, - }) + // Main page files (e.g., resources/clusterroletemplate.mdx) are NOT generated. + // They must be manually created and maintained, following the vcluster pattern + // where partials are auto-generated but main pages are always manual. + // This allows adding custom documentation sections that won't be overwritten. } func GenerateFromPath(schema *jsonschema.Schema, basePath string, schemaPath string, defaults map[string]interface{}) { diff --git a/hack/platform/util/template_overview.go b/hack/platform/util/template_overview.go deleted file mode 100644 index c46243b3d..000000000 --- a/hack/platform/util/template_overview.go +++ /dev/null @@ -1,116 +0,0 @@ -package util - -type ObjectOverviewValues struct { - Title string - Name string - Plural string - - RelativePath string - Resource string - SubResource string - - Description string - YAMLObject string - - Project bool - - Create bool - Retrieve bool - Update bool - Delete bool - - SubResourceCreate bool - SubResourceGet bool -} - -const TemplateObjectOverview = `--- -title: {{ .Title }} -sidebar_label: {{ .Title }} ---- -{{- if .SubResource }} -import Reference from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/{{ .SubResource }}/reference.mdx" -{{- if .SubResourceCreate }} -import SubResourceCreate from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/{{ .SubResource }}/subresourcecreate.mdx" -{{- end }} -{{- if .SubResourceGet }} -import SubResourceGet from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/{{ .SubResource }}/subresourceget.mdx" -{{- end }} -{{- else }} -import Reference from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/reference.mdx" -{{- if .Retrieve }} -import Retrieve from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/retrieve.mdx" -{{- end }} -{{- if .Create }} -import Create from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/create.mdx" -{{- end }} -{{- if .Update }} -import Update from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/update.mdx" -{{- end }} -{{- if .Delete }} -import Delete from "{{ .RelativePath }}/_partials/resources/{{ .Resource }}/delete.mdx" -{{- end }} -{{- end }} - -{{ .Description }} - -## {{ .Name }} example - -An example {{ .Name }}: -` + "```yaml" + ` -{{ .YAMLObject }} -` + "```" + ` - -## {{ .Name }} reference - - - -{{- if .Retrieve }} - -## Retrieve: {{ .Plural }} - - - -{{- end }} - -{{- if .Create }} - -## Create: {{ .Name }} - - - -{{- end }} - -{{- if .Update }} - -## Update: {{ .Name }} - - - -{{- end }} - -{{- if .Delete }} - -## Delete: {{ .Name }} - - - -{{- end }} - -{{- if .SubResourceGet }} - -## {{ .Name }} (Get) - - - -{{- end }} - -{{- if .SubResourceCreate }} - -## {{ .Name }} (Create) - - - -{{- end }} - - -`