Skip to content

Commit e8bb595

Browse files
micrycfrantuma
authored andcommitted
Add test
1 parent 518007d commit e8bb595

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Diff for: modules/swagger-java17-support/src/test/java/io/swagger/v3/java17/resolving/JavaRecordTest.java

+37
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,41 @@ public record JavaRecordClassWithBeanValidation(
8080
){
8181
}
8282

83+
@Test
84+
public void testJavaRecordWithBeanValidationSizeTypeUse() {
85+
String expectedYaml = "JavaRecordWithAnnotationsOnGenericType:\n" +
86+
" type: object\n" +
87+
" properties:\n" +
88+
" randomList:\n" +
89+
" maxItems: 10000\n" +
90+
" minItems: 100\n" +
91+
" type: array\n" +
92+
" items:\n" +
93+
" maxLength: 10\n" +
94+
" minLength: 1\n" +
95+
" type: string\n" +
96+
" secondList:\n" +
97+
" type: array\n" +
98+
" items:\n" +
99+
" pattern: (.+?)@(.+?)\n" +
100+
" type: string\n" +
101+
" id:\n" +
102+
" type: array\n" +
103+
" items:\n" +
104+
" maximum: 10000\n" +
105+
" minimum: 1\n" +
106+
" type: integer\n" +
107+
" format: int32";
108+
109+
Map<String, Schema> stringSchemaMap = ModelConverters.getInstance(false).readAll(JavaRecordWithAnnotationsOnGenericType.class);
110+
SerializationMatchers.assertEqualsToYaml(stringSchemaMap, expectedYaml);
111+
}
112+
113+
public record JavaRecordWithAnnotationsOnGenericType(
114+
@Size(min = 100, max = 10000)
115+
List<@Size(min = 1, max = 10) String> randomList,
116+
List<@Pattern(regexp = "(.+?)@(.+?)") String> secondList,
117+
List<@Min(1)@Max(10000) Integer> id
118+
){
119+
}
83120
}

0 commit comments

Comments
 (0)