Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
micryc authored and frantuma committed Nov 12, 2024
1 parent 518007d commit e8bb595
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,41 @@ public record JavaRecordClassWithBeanValidation(
){
}

@Test
public void testJavaRecordWithBeanValidationSizeTypeUse() {
String expectedYaml = "JavaRecordWithAnnotationsOnGenericType:\n" +
" type: object\n" +
" properties:\n" +
" randomList:\n" +
" maxItems: 10000\n" +
" minItems: 100\n" +
" type: array\n" +
" items:\n" +
" maxLength: 10\n" +
" minLength: 1\n" +
" type: string\n" +
" secondList:\n" +
" type: array\n" +
" items:\n" +
" pattern: (.+?)@(.+?)\n" +
" type: string\n" +
" id:\n" +
" type: array\n" +
" items:\n" +
" maximum: 10000\n" +
" minimum: 1\n" +
" type: integer\n" +
" format: int32";

Map<String, Schema> stringSchemaMap = ModelConverters.getInstance(false).readAll(JavaRecordWithAnnotationsOnGenericType.class);
SerializationMatchers.assertEqualsToYaml(stringSchemaMap, expectedYaml);
}

public record JavaRecordWithAnnotationsOnGenericType(
@Size(min = 100, max = 10000)
List<@Size(min = 1, max = 10) String> randomList,
List<@Pattern(regexp = "(.+?)@(.+?)") String> secondList,
List<@Min(1)@Max(10000) Integer> id
){
}
}

0 comments on commit e8bb595

Please sign in to comment.