Skip to content

Add jakarta.validation.valueextraction.ValueExtractor for ArgumentValue #736

Closed as not planned
@bduisenov

Description

@bduisenov

Validation annotations on ArgumentValue are not working as there's no ValueExtractor provided.
For example, this code ArgumentValue<@NotBlank @Size(min = 2, max = 500) String> name will not work as expected.

Adding ValueExtractor will solve the issue

@UnwrapByDefault
public class ArgumentValueExtractor implements ValueExtractor<ArgumentValue<@ExtractedValue ?>> {

    @Override
    public void extractValues(ArgumentValue<?> originalValue, ValueReceiver receiver) {
        if (originalValue.isPresent()) {
            receiver.value(null, originalValue.value());
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions