mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
fetch a shared correlated object off the validation options if it exists
c
This commit is contained in:
parent
0a19b5ab6e
commit
dfeab6eca8
@ -60,8 +60,20 @@ func (r *RatchetingSchemaValidator) Validate(new interface{}, options ...Validat
|
||||
}
|
||||
|
||||
func (r *RatchetingSchemaValidator) ValidateUpdate(new, old interface{}, options ...ValidationOption) *validate.Result {
|
||||
opts := NewValidationOptions(options...)
|
||||
|
||||
if !opts.Ratcheting {
|
||||
sv := validate.NewSchemaValidator(r.schema, r.root, r.path, r.knownFormats, r.options...)
|
||||
return sv.Validate(new)
|
||||
}
|
||||
|
||||
correlation := opts.CorrelatedObject
|
||||
if correlation == nil {
|
||||
correlation = common.NewCorrelatedObject(new, old, &celopenapi.Schema{Schema: r.schema})
|
||||
}
|
||||
|
||||
return newRatchetingValueValidator(
|
||||
common.NewCorrelatedObject(new, old, &celopenapi.Schema{Schema: r.schemaArgs.schema}),
|
||||
correlation,
|
||||
r.schemaArgs,
|
||||
).Validate(new)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user