Skip to content

Commit

Permalink
fix: YAML rendering of structs embedded in rules (#283)
Browse files Browse the repository at this point in the history
## Description
In previous PRs, we made the plugin rules implement the new
`validationrule.Interface` interface. We did not include YAML tags in
rules to specify that the new field (`validationrule.ManuallyNamed` or
`validationrule.AutomaticallyNamed` depending on the rule) should not be
included when the rules are rendered to YAML. The validatorctl CLI
renders the rules to YAML as part of what it does, so this caused errors
when validatorctl tried to apply validator CRDs it generated to its
cluster.

Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
  • Loading branch information
mattwelke authored Aug 24, 2024
1 parent f99fdbd commit b86e6b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/v1alpha1/ocivalidator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s OciValidatorSpec) ResultCount() int {

// OciRegistryRule defines the validation rule for an OCI registry.
type OciRegistryRule struct {
validationrule.ManuallyNamed `json:",inline"`
validationrule.ManuallyNamed `json:",inline" yaml:",omitempty"`

// Name is a unique name for the OciRegistryRule.
RuleName string `json:"name" yaml:"name"`
Expand Down

0 comments on commit b86e6b9

Please sign in to comment.