From 0673f4c582e5d671c924d0e711d4d2afc4422098 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 21 Apr 2025 11:19:03 -0400 Subject: [PATCH 1/2] Added client capabilities into the validator request for write only attributes --- .../prefer_write_only_attribute.go | 99 ++++++++++--------- 1 file changed, 55 insertions(+), 44 deletions(-) diff --git a/internal/schemavalidator/prefer_write_only_attribute.go b/internal/schemavalidator/prefer_write_only_attribute.go index fa58406d..e31bc1f0 100644 --- a/internal/schemavalidator/prefer_write_only_attribute.go +++ b/internal/schemavalidator/prefer_write_only_attribute.go @@ -96,10 +96,11 @@ func (av PreferWriteOnlyAttribute) Validate(ctx context.Context, req PreferWrite func (av PreferWriteOnlyAttribute) ValidateBool(ctx context.Context, req validator.BoolRequest, resp *validator.BoolResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -110,10 +111,11 @@ func (av PreferWriteOnlyAttribute) ValidateBool(ctx context.Context, req validat func (av PreferWriteOnlyAttribute) ValidateDynamic(ctx context.Context, req validator.DynamicRequest, resp *validator.DynamicResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -124,10 +126,11 @@ func (av PreferWriteOnlyAttribute) ValidateDynamic(ctx context.Context, req vali func (av PreferWriteOnlyAttribute) ValidateFloat32(ctx context.Context, req validator.Float32Request, resp *validator.Float32Response) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -138,10 +141,11 @@ func (av PreferWriteOnlyAttribute) ValidateFloat32(ctx context.Context, req vali func (av PreferWriteOnlyAttribute) ValidateFloat64(ctx context.Context, req validator.Float64Request, resp *validator.Float64Response) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -152,10 +156,11 @@ func (av PreferWriteOnlyAttribute) ValidateFloat64(ctx context.Context, req vali func (av PreferWriteOnlyAttribute) ValidateInt32(ctx context.Context, req validator.Int32Request, resp *validator.Int32Response) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -166,10 +171,11 @@ func (av PreferWriteOnlyAttribute) ValidateInt32(ctx context.Context, req valida func (av PreferWriteOnlyAttribute) ValidateInt64(ctx context.Context, req validator.Int64Request, resp *validator.Int64Response) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -180,10 +186,11 @@ func (av PreferWriteOnlyAttribute) ValidateInt64(ctx context.Context, req valida func (av PreferWriteOnlyAttribute) ValidateList(ctx context.Context, req validator.ListRequest, resp *validator.ListResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -194,10 +201,11 @@ func (av PreferWriteOnlyAttribute) ValidateList(ctx context.Context, req validat func (av PreferWriteOnlyAttribute) ValidateMap(ctx context.Context, req validator.MapRequest, resp *validator.MapResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -208,10 +216,11 @@ func (av PreferWriteOnlyAttribute) ValidateMap(ctx context.Context, req validato func (av PreferWriteOnlyAttribute) ValidateNumber(ctx context.Context, req validator.NumberRequest, resp *validator.NumberResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -222,10 +231,11 @@ func (av PreferWriteOnlyAttribute) ValidateNumber(ctx context.Context, req valid func (av PreferWriteOnlyAttribute) ValidateObject(ctx context.Context, req validator.ObjectRequest, resp *validator.ObjectResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} @@ -236,10 +246,11 @@ func (av PreferWriteOnlyAttribute) ValidateObject(ctx context.Context, req valid func (av PreferWriteOnlyAttribute) ValidateString(ctx context.Context, req validator.StringRequest, resp *validator.StringResponse) { validateReq := PreferWriteOnlyAttributeRequest{ - Config: req.Config, - ConfigValue: req.ConfigValue, - Path: req.Path, - PathExpression: req.PathExpression, + Config: req.Config, + ConfigValue: req.ConfigValue, + Path: req.Path, + PathExpression: req.PathExpression, + ClientCapabilities: req.ClientCapabilities, } validateResp := &PreferWriteOnlyAttributeResponse{} From ffdfebb3a64569f17a5e33d74ed632a2205dd7bc Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 21 Apr 2025 11:21:49 -0400 Subject: [PATCH 2/2] Changelog Entry --- .changes/unreleased/BUG FIXES-20250421-112124.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/BUG FIXES-20250421-112124.yaml diff --git a/.changes/unreleased/BUG FIXES-20250421-112124.yaml b/.changes/unreleased/BUG FIXES-20250421-112124.yaml new file mode 100644 index 00000000..8c2c0d3a --- /dev/null +++ b/.changes/unreleased/BUG FIXES-20250421-112124.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: Added client capabilities into the validator request for write only attributes +time: 2025-04-21T11:21:24.306898-04:00 +custom: + Issue: "286"