Skip to content

Commit

Permalink
fixed schema validation. Has it ever worked?
Browse files Browse the repository at this point in the history
Signed-off-by: raffaelespazzoli <raffaele.spazzoli@gmail.com>
  • Loading branch information
raffaelespazzoli committed Nov 22, 2023
1 parent 7e05c5c commit f35f5b6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (lrm *LockedResourceManager) validateLockedResources(lockedResources []lock
result = multierror.Append(result, errors.New("resource type:"+lockedResource.Unstructured.GroupVersionKind().String()+"not defined"))
continue
}
err = templates.ValidateUnstructured(ctx, &lockedResource.Unstructured, schemaValidation.(*validation.NullSchema))
err = templates.ValidateUnstructured(ctx, &lockedResource.Unstructured, schemaValidation)
if err != nil {
lrm.log.Error(err, "unable to validate", "unstructured", lockedResource.Unstructured)
result = multierror.Append(result, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/templates/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func ProcessTemplateArray(context context.Context, data interface{}, template *t
// ValidateUnstructured validates the content of an unstructured against an openapi schema.
// the schema is intended to be retrieved from a running instance of kubernetes, but other usages are possible.
// requires a context with log
func ValidateUnstructured(context context.Context, obj *unstructured.Unstructured, validationSchema *validation.NullSchema) error {
func ValidateUnstructured(context context.Context, obj *unstructured.Unstructured, validationSchema validation.Schema) error {
log := log.FromContext(context)
bb, err := obj.MarshalJSON()
if err != nil {
Expand Down

0 comments on commit f35f5b6

Please sign in to comment.