Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ func parseMarkers(markers markers.MarkerValues) (string, []string) {
// E.g. "XValidation: {self.page < 200 Please start a new book.}"
case "XValidation":
continue
case "Required", "Optional":
value = "True"
}
validation = append(validation, fmt.Sprintf("%s: %v", name, value))
}
Expand All @@ -581,12 +583,12 @@ func parseMarkers(markers markers.MarkerValues) (string, []string) {
// Handle standalone +required and +k8s:required marker
// This is equivalent to +kubebuilder:validation:Required
if name == "required" || name == "k8s:required" {
validation = append(validation, "Required: {}")
validation = append(validation, "Required: True")
}
// Handle standalone +optional and +k8s:optional marker
// This is equivalent to +kubebuilder:validation:Optional
if name == "optional" || name == "k8s:optional" {
validation = append(validation, "Optional: {}")
validation = append(validation, "Optional: True")
}
}

Expand Down
10 changes: 5 additions & 5 deletions test/expected.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ GuestbookEntry defines an entry in a guest book. See https://example.com/old-pag
| Field | Description | Default | Validation
| *`name`* __string__ | Name of the guest (pipe \| should be escaped). See https://example.com/old-page for naming guidance. + | | MaxLength: 80 +
Pattern: `0\*[a-z0-9]*[a-z]*[0-9]` +
Required: \{} +
Required: True +

| *`tags`* __string array__ | Tags of the entry. + | | items:Pattern: `[a-z]*` +

Expand All @@ -180,13 +180,13 @@ Looks good? + | | Pattern: `0\*[a-z0-9]*[a-z]\*[0-9]*\|\s` +
| *`rating`* __xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-rating[$$Rating$$]__ | Rating provided by the guest + | | Maximum: 5 +
Minimum: 1 +

| *`email`* __string__ | Email is the email address of the guest (required field using +required marker) + | | Required: \{} +
| *`email`* __string__ | Email is the email address of the guest (required field using +required marker) + | | Required: True +

| *`location`* __string__ | Location is the location of the guest (required field using +k8s:required marker) + | | Required: \{} +
| *`location`* __string__ | Location is the location of the guest (required field using +k8s:required marker) + | | Required: True +

| *`phone`* __string__ | Phone is the phone number of the guest (optional field using +optional marker) + | | Optional: \{} +
| *`phone`* __string__ | Phone is the phone number of the guest (optional field using +optional marker) + | | Optional: True +

| *`company`* __string__ | Company is the company of the guest (optional field using +k8s:optional marker) + | | Optional: \{} +
| *`company`* __string__ | Company is the company of the guest (optional field using +k8s:optional marker) + | | Optional: True +

|===

Expand Down
10 changes: 5 additions & 5 deletions test/expected.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `name` _string_ | Name of the guest (pipe \| should be escaped). See [New page](docs-content://new/page.md) for naming guidance. | | MaxLength: 80 <br />Pattern: `0*[a-z0-9]*[a-z]*[0-9]` <br />Required: \{\} <br /> |
| `name` _string_ | Name of the guest (pipe \| should be escaped). See [New page](docs-content://new/page.md) for naming guidance. | | MaxLength: 80 <br />Pattern: `0*[a-z0-9]*[a-z]*[0-9]` <br />Required: True <br /> |
| `tags` _string array_ | Tags of the entry. | | items:Pattern: `[a-z]*` <br /> |
| `time` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#time-v1-meta)_ | Time of entry | | |
| `comment` _string_ | Comment by guest. This can be a multi-line comment.<br />Like this one.<br />Now let's test a list:<br />* a<br />* b<br />Another isolated comment.<br />Looks good? | | Pattern: `0*[a-z0-9]*[a-z]*[0-9]*\|\s` <br /> |
| `rating` _[Rating](#rating)_ | Rating provided by the guest | | Maximum: 5 <br />Minimum: 1 <br /> |
| `email` _string_ | Email is the email address of the guest (required field using +required marker) | | Required: \{\} <br /> |
| `location` _string_ | Location is the location of the guest (required field using +k8s:required marker) | | Required: \{\} <br /> |
| `phone` _string_ | Phone is the phone number of the guest (optional field using +optional marker) | | Optional: \{\} <br /> |
| `company` _string_ | Company is the company of the guest (optional field using +k8s:optional marker) | | Optional: \{\} <br /> |
| `email` _string_ | Email is the email address of the guest (required field using +required marker) | | Required: True <br /> |
| `location` _string_ | Location is the location of the guest (required field using +k8s:required marker) | | Required: True <br /> |
| `phone` _string_ | Phone is the phone number of the guest (optional field using +optional marker) | | Optional: True <br /> |
| `company` _string_ | Company is the company of the guest (optional field using +k8s:optional marker) | | Optional: True <br /> |


#### GuestbookHeader
Expand Down
10 changes: 5 additions & 5 deletions test/hide.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ _Appears in:_

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `name` _string_ | Name of the guest (pipe \| should be escaped). See [New page](docs-content://new/page.md) for naming guidance. | | MaxLength: 80 <br />Pattern: `0*[a-z0-9]*[a-z]*[0-9]` <br />Required: \{\} <br /> |
| `name` _string_ | Name of the guest (pipe \| should be escaped). See [New page](docs-content://new/page.md) for naming guidance. | | MaxLength: 80 <br />Pattern: `0*[a-z0-9]*[a-z]*[0-9]` <br />Required: True <br /> |
| `tags` _string array_ | Tags of the entry. | | items:Pattern: `[a-z]*` <br /> |
| `time` _[Time](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#time-v1-meta)_ | Time of entry | | |
| `comment` _string_ | Comment by guest. This can be a multi-line comment.<br />Like this one.<br />Now let's test a list:<br />* a<br />* b<br />Another isolated comment.<br />Looks good? | | Pattern: `0*[a-z0-9]*[a-z]*[0-9]*\|\s` <br /> |
| `rating` _[Rating](#rating)_ | Rating provided by the guest | | Maximum: 5 <br />Minimum: 1 <br /> |
| `email` _string_ | Email is the email address of the guest (required field using +required marker) | | Required: \{\} <br /> |
| `location` _string_ | Location is the location of the guest (required field using +k8s:required marker) | | Required: \{\} <br /> |
| `phone` _string_ | Phone is the phone number of the guest (optional field using +optional marker) | | Optional: \{\} <br /> |
| `company` _string_ | Company is the company of the guest (optional field using +k8s:optional marker) | | Optional: \{\} <br /> |
| `email` _string_ | Email is the email address of the guest (required field using +required marker) | | Required: True <br /> |
| `location` _string_ | Location is the location of the guest (required field using +k8s:required marker) | | Required: True <br /> |
| `phone` _string_ | Phone is the phone number of the guest (optional field using +optional marker) | | Optional: True <br /> |
| `company` _string_ | Company is the company of the guest (optional field using +k8s:optional marker) | | Optional: True <br /> |


#### GuestbookHeader
Expand Down