You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Value is the payload value of a marker represented as a string.
410
+
// Value is set when the payload value of a marker is not another marker.
411
+
Valuestring
412
+
413
+
// Marker is the marker in the payload value of another marker.
414
+
// Marker is only set when the payload value of a marker is another marker.
415
+
Marker*Marker
321
416
}
322
417
323
418
// Marker represents a marker extracted from a comment on a declaration.
324
419
typeMarkerstruct {
420
+
// Type is the marker representation this marker was identified as.
421
+
// Currently, the two marker format types are DeclarativeValidation and Kubebuilder.
422
+
// Because the Kubebuilder style has been around the longest and is widely
423
+
// used in projects that have CustomResourceDefinitions we default to Kubebuilder
424
+
// style parsing unless we detect that the marker follows the declarative validation
425
+
// format (i.e begins with +k8s:).
426
+
TypeMarkerType
427
+
325
428
// Identifier is the value of the marker once the leading comment, '+', and expressions are trimmed.
326
429
Identifierstring
327
430
328
-
// Expressions are the set of expressions that have been specified for the marker
329
-
Expressionsmap[string]string
431
+
// Arguments are the set of named and unnamed arguments that have been specified for the marker.
432
+
//
433
+
// For Markers with Type == Kubebuilder, there will only ever be named arguments. The following examples highlight how arguments are extracted:
434
+
// - `+kubebuilder:validation:Required` would result in *no* arguments.
435
+
// - `+required` would result in *no* arguments.
436
+
// - `+kubebuilder:validation:MinLength=10` would result in no arguments`.
437
+
// - `+kubebuilder:validation:XValidation:rule="has(self)",message="should have self"` would result in 2 named arguments, `rule` and `message` with their respective values in string representation.
438
+
//
439
+
// For Markers with Type == DeclarativeValidation, arguments are extracted from the marker parameters. Arguments may be named or unnamed.
440
+
// Some examples:
441
+
// - `+k8s:forbidden` would result in *no* arguments.
442
+
// - `+k8s:ifEnabled("my-feature")=...` would result in a single unnamed argument (represented by key `""`) with a value of `"my-feature"`.
443
+
// - `+k8s:item(one: "value", two: "value")=...` would result in 2 named arguments, `one` and `two` with their respective values in string representation.
444
+
Argumentsmap[string]string
445
+
446
+
// Payload is the payload specified by the marker.
447
+
// In general, it is what is present after the first `=` symbol
448
+
// of a marker.
449
+
PayloadPayload
330
450
331
451
// RawComment is the raw comment line, unfiltered.
0 commit comments