Skip to content

Commit 09e27b5

Browse files
fixed schema validation. Has it ever worked? (#98)
Signed-off-by: raffaelespazzoli <[email protected]>
1 parent 7e05c5c commit 09e27b5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/util/lockedresourcecontroller/locked-resource-manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (lrm *LockedResourceManager) validateLockedResources(lockedResources []lock
338338
result = multierror.Append(result, errors.New("resource type:"+lockedResource.Unstructured.GroupVersionKind().String()+"not defined"))
339339
continue
340340
}
341-
err = templates.ValidateUnstructured(ctx, &lockedResource.Unstructured, schemaValidation.(*validation.NullSchema))
341+
err = templates.ValidateUnstructured(ctx, &lockedResource.Unstructured, schemaValidation)
342342
if err != nil {
343343
lrm.log.Error(err, "unable to validate", "unstructured", lockedResource.Unstructured)
344344
result = multierror.Append(result, err)

pkg/util/templates/templates.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func ProcessTemplateArray(context context.Context, data interface{}, template *t
107107
// ValidateUnstructured validates the content of an unstructured against an openapi schema.
108108
// the schema is intended to be retrieved from a running instance of kubernetes, but other usages are possible.
109109
// requires a context with log
110-
func ValidateUnstructured(context context.Context, obj *unstructured.Unstructured, validationSchema *validation.NullSchema) error {
110+
func ValidateUnstructured(context context.Context, obj *unstructured.Unstructured, validationSchema validation.Schema) error {
111111
log := log.FromContext(context)
112112
bb, err := obj.MarshalJSON()
113113
if err != nil {

0 commit comments

Comments
 (0)