diff --git a/processor/processor.go b/processor/processor.go
index 6939e4d..76c8905 100644
--- a/processor/processor.go
+++ b/processor/processor.go
@@ -554,6 +554,12 @@ func parseMarkers(markers markers.MarkerValues) (string, []string) {
validation = append(validation, fmt.Sprintf("%s: %v", name, value))
}
+ // Handle standalone +required marker
+ // This is equivalent to +kubebuilder:validation:Required
+ if name == "required" {
+ validation = append(validation, "Required: {}")
+ }
+
if name == "kubebuilder:default" {
if value, ok := value.(crdmarkers.Default); ok {
defaultValue = fmt.Sprintf("%v", value.Value)
diff --git a/test/api/v1/guestbook_types.go b/test/api/v1/guestbook_types.go
index 5dbdcb0..78fd520 100644
--- a/test/api/v1/guestbook_types.go
+++ b/test/api/v1/guestbook_types.go
@@ -146,6 +146,12 @@ type GuestbookEntry struct {
Comment string `json:"comment,omitempty"`
// Rating provided by the guest
Rating Rating `json:"rating,omitempty"`
+ // Email is the email address of the guest (required field using +required marker)
+ // +required
+ Email string `json:"email"`
+ // Location is the location of the guest (required field using +kubebuilder:validation:Required marker)
+ // +kubebuilder:validation:Required
+ Location string `json:"location"`
}
// GuestbookStatus defines the observed state of Guestbook.
diff --git a/test/expected.asciidoc b/test/expected.asciidoc
index a5a642e..5cfdceb 100644
--- a/test/expected.asciidoc
+++ b/test/expected.asciidoc
@@ -179,6 +179,10 @@ 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: \{} +
+
+| *`location`* __string__ | Location is the location of the guest (required field using +kubebuilder:validation:Required marker) + | | Required: \{} +
+
|===
diff --git a/test/expected.md b/test/expected.md
index a3678da..65d3596 100644
--- a/test/expected.md
+++ b/test/expected.md
@@ -132,6 +132,8 @@ _Appears in:_
| `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.
Like this one.
Now let's test a list:
* a
* b
Another isolated comment.
Looks good? | | Pattern: `0*[a-z0-9]*[a-z]*[0-9]*\|\s`
|
| `rating` _[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: \{\}
|
+| `location` _string_ | Location is the location of the guest (required field using +kubebuilder:validation:Required marker) | | Required: \{\}
|
#### GuestbookHeader