From ffd822cfddbd68c1018b0ad3ec9676b288fdebc4 Mon Sep 17 00:00:00 2001 From: Dimitris Polissiou Date: Tue, 5 Nov 2024 13:05:33 +0200 Subject: [PATCH] Fix smallrye#2219: bean validation regression for null values --- .../graphql/validation/BeanValidationError.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server/implementation/src/main/java/io/smallrye/graphql/validation/BeanValidationError.java b/server/implementation/src/main/java/io/smallrye/graphql/validation/BeanValidationError.java index 54c61636f..1c04a8c92 100644 --- a/server/implementation/src/main/java/io/smallrye/graphql/validation/BeanValidationError.java +++ b/server/implementation/src/main/java/io/smallrye/graphql/validation/BeanValidationError.java @@ -62,11 +62,13 @@ public Map getExtensions() { } private Map getViolationAttributes(ConstraintViolation violation) { - return Map.of( - "message", violation.getMessage(), - "propertyPath", toStream(violation.getPropertyPath()).flatMap(this::items).collect(toList()), - "invalidValue", violation.getInvalidValue(), - "constraint", getConstraintAttributes(violation)); + Map attributes = new HashMap<>(); + attributes.put("message", violation.getMessage()); + attributes.put("propertyPath", + toStream(violation.getPropertyPath()).flatMap(this::items).collect(toList())); + attributes.put("invalidValue", violation.getInvalidValue()); + attributes.put("constraint", getConstraintAttributes(violation)); + return attributes; } private Stream items(Path.Node node) {