Skip to content

Commit

Permalink
Merge pull request #2247 from machine424/omitdoc
Browse files Browse the repository at this point in the history
MON-3699: chore: merge OmitFromDoc with HideFromDoc introduced in #2210 to hide fields from the doc
  • Loading branch information
openshift-merge-bot[bot] authored Feb 2, 2024
2 parents 1bbf0f0 + 30bd30c commit 9e3c39a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
3 changes: 0 additions & 3 deletions hack/docgen/format/asciidocs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ func PrintAPIDocs(args []string) {
moduleContent += "|===\n"
moduleContent += "| Property | Type | Description \n"
for _, f := range t.Fields {
if strings.HasPrefix(fmt.Sprint(f.Description()), "OmitFromDoc") {
continue
}
moduleContent += fmt.Sprint("|", f.Name(), "|", f.TypeLink(typeSetUnion), "|", f.Description(), "\n\n")
}
moduleContent += "|===\n"
Expand Down
3 changes: 0 additions & 3 deletions hack/docgen/format/markdown/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ func PrintAPIDocs(args []string) {
fmt.Println("| Property | Type | Description |")
fmt.Println("| -------- | ---- | ----------- |")
for _, f := range t.Fields {
if strings.HasPrefix(fmt.Sprint(f.Description()), "OmitFromDoc") {
continue
}
fmt.Println("|", f.Name(), "|", f.TypeLink(typeSetUnion), "|", f.Description(), "|")
}
fmt.Println("")
Expand Down
10 changes: 5 additions & 5 deletions hack/docgen/model/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Load(path string) (TypeSet, error) {

for _, t := range types.Types {
structType, ok := t.Decl.Specs[0].(*ast.TypeSpec).Type.(*ast.StructType)
if !ok || hideFromDoc(t.Doc) {
if !ok || omitFromDoc(t.Doc) {
continue
}

Expand All @@ -49,7 +49,7 @@ func Load(path string) (TypeSet, error) {
for _, currentStruct := range structs {
for _, field := range currentStruct.rawFields {
field := Field(*field)
if hideFromDoc(field.Doc.Text()) {
if omitFromDoc(field.Doc.Text()) {
continue
}
if field.IsInlined() {
Expand Down Expand Up @@ -83,9 +83,9 @@ func Load(path string) (TypeSet, error) {
return structs, nil
}

// hideFromDoc helps filetring out elements that are not intended to be shown in docs.
func hideFromDoc(doc string) bool {
return strings.HasPrefix(doc, "HideFromDoc: ")
// omitFromDoc helps filetring out elements that are not intended to be shown in docs.
func omitFromDoc(doc string) bool {
return strings.HasPrefix(doc, "OmitFromDoc")
}

func mergeFields(to *StructType, from *StructType, structs TypeSet) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/manifests/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ type K8sPrometheusAdapter struct {
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
// Defines a pod's topology spread constraints.
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
// HideFromDoc: Defines dedicated service monitors.
// OmitFromDoc: Defines dedicated service monitors.
DedicatedServiceMonitors *DedicatedServiceMonitors `json:"dedicatedServiceMonitors,omitempty"`
}

Expand All @@ -134,7 +134,7 @@ type MetricsServerConfig struct {
TopologySpreadConstraints []v1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
}

// HideFromDoc: This is deprecated and will be removed in a future version, setting it has no effect.
// OmitFromDoc: This is deprecated and will be removed in a future version, setting it has no effect.
type DedicatedServiceMonitors struct {
Enabled bool `json:"enabled,omitempty"`
}
Expand Down

0 comments on commit 9e3c39a

Please sign in to comment.