Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bean Validation API 2.0 does not work with Kotlin in MVC [SPR-16923] #21462

Open
spring-projects-issues opened this issue Jun 8, 2018 · 3 comments

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 8, 2018

Ankur Pathak opened SPR-16923 and commented

class Name : Serializable

{ @NotBlank var value: String? = null }

class Names

{ @NotEmpty var names: MutableList<@Valid @NotNull Name>? = null }

Bean Validation 2 constrains @Valid @NotNull does not work on Generics  Type Param in Kotlin with Spring Web MVC.

But if you replace kotlin Names class with java version of same it works.

public class Names {

@NotEmpty
private List<@NotNull @Valid Name> names;

public List<Name> getNames() {
return names;
}

public void setNames(List<Name> names) {
this.names = names;
}
}

But Bean Validation 2 constrains @Valid @NotNull  work on Generics  Type Param in Java with Spring Web MVC.

 

 

 

 

 


Affects: 5.0.1

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 28, 2018

Sébastien Deleuze commented

I have been able to reproduce this issue.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 28, 2018

Sébastien Deleuze commented

I have raised KT-25158 on Kotlin side.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 11, 2018

Ankur Pathak commented

The issue registered with Kotlin taking into account:

  var names: List<Name>  ---1

But this is not the way we use collections in Kotlin. We use something like:

var names: MutableList<Name> --2

Even if we get it fixed for case 1 from Kotlin , they how it will work for case 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants