Skip to content

Commit

Permalink
crd: Respect multiline comments at godocs
Browse files Browse the repository at this point in the history
Sometimes at type has examples about how to use it embedding something
like a yaml on it, yamls should not be truncated and they are white
space sensitive. This change keep the new lines and also remove the
white space trimming only on /* comments.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
  • Loading branch information
qinqon committed Dec 20, 2023
1 parent 943de6e commit 3dee960
Show file tree
Hide file tree
Showing 6 changed files with 2,802 additions and 3,385 deletions.
20 changes: 13 additions & 7 deletions pkg/crd/testdata/gen/bar.example.com_foos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ spec:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
Expand All @@ -35,7 +40,8 @@ spec:
properties:
defaultedString:
default: fooDefaultString
description: This tests that defaulted fields are stripped for v1beta1,
description: |-
This tests that defaulted fields are stripped for v1beta1,
but not for v1
example: fooExampleString
type: string
Expand Down

0 comments on commit 3dee960

Please sign in to comment.