-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd68f03
commit 0bf8be2
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package v1alpha | ||
|
||
import "github.com/nobl9/nobl9-go/validation" | ||
|
||
func FieldRuleMetdataName(getter func() string) validation.FieldRules[string] { | ||
return validation.RulesForField[string]("metadata.name", getter). | ||
With(validation.StringRequired(), validation.StringIsDNSSubdomain()) | ||
} | ||
|
||
func FieldRuleMetadataDisplayName(getter func() string) validation.FieldRules[string] { | ||
return validation.RulesForField[string]("metadata.displayName", getter). | ||
With(validation.StringLength(0, 63)) | ||
} | ||
|
||
func FieldRuleMetdataProject(getter func() string) validation.FieldRules[string] { | ||
return validation.RulesForField[string]("metadata.project", getter). | ||
With(validation.StringRequired(), validation.StringIsDNSSubdomain()) | ||
} | ||
|
||
func FieldRuleMetadataLabels(getter func() Labels) validation.FieldRules[Labels] { | ||
return validation.RulesForField[Labels]("metadata.labels", getter). | ||
With(ValidationRule()) | ||
} | ||
|
||
func FieldRuleMetadataDescription(getter func() string) validation.FieldRules[string] { | ||
return validation.RulesForField[string]("spec.description", getter). | ||
With(validation.StringDescription()) | ||
} |