https://github.com/mduesterhoeft/bean-validation-container-constraints
https://github.com/mduesterhoeft/bean-validation-container-constraints
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mduesterhoeft/bean-validation-container-constraints
- Owner: mduesterhoeft
- Created: 2018-06-29T16:04:23.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-01-08T15:58:18.000Z (over 5 years ago)
- Last Synced: 2023-03-03T04:07:32.776Z (over 3 years ago)
- Language: Kotlin
- Homepage: https://stackoverflow.com/questions/51085138/kotlin-data-class-and-bean-validation-with-container-element-constraints
- Size: 53.7 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repo is a sample to reproduce the issue described here - https://stackoverflow.com/questions/51085138/kotlin-data-class-and-bean-validation-with-container-element-constraints
The test in [BeanValidationContainerConstraintsApplicationTests](src/test/kotlin/com/example/beanvalidationcontainerconstraints/BeanValidationContainerConstraintsApplicationTests.kt) fails because it expects two validation errors:
- `name` is empty
- the map value in `someMap`
```kotlin
data class SamplePayload(
@field:NotEmpty val name: String,
@field:NotEmpty val someMap: Map)
```
The `@NotEmpty` annotation on the **value type** of the map `someMap` is not considered.
See https://beanvalidation.org/2.0/spec/#constraintdeclarationvalidationprocess-containerelementconstraints.
Run the test with:
```
./gradlew test
```