Skip to content
Closed
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: 6 additions & 0 deletions processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions test/api/v1/guestbook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions test/expected.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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: \{} +

|===


Expand Down
2 changes: 2 additions & 0 deletions test/expected.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<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 +kubebuilder:validation:Required marker) | | Required: \{\} <br /> |


#### GuestbookHeader
Expand Down