Skip to content

Commit 6d3602c

Browse files
committed
refs #4462 - exclude javax.validation annotations from container values processing
1 parent 006b1ae commit 6d3602c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/ModelResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
432432
if (annotatedType.getCtxAnnotations() != null) {
433433
strippedCtxAnnotations.addAll(Arrays.stream(
434434
annotatedType.getCtxAnnotations()).filter(
435-
ass -> !ass.annotationType().getName().startsWith("io.swagger")
435+
ass -> !ass.annotationType().getName().startsWith("io.swagger") && !ass.annotationType().getName().startsWith("javax.validation.constraints")
436436
).collect(Collectors.toList()));
437437
}
438438

modules/swagger-core/src/test/java/io/swagger/v3/core/converting/override/ModelPropertyOverrideTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ public void customAnnotationTest() throws Exception {
9393
" maxItems: 2\n" +
9494
" type: array\n" +
9595
" items:\n" +
96-
" type: string\n";
96+
" type: string\n" +
97+
" sized:\n" +
98+
" maxItems: 2\n" +
99+
" minItems: 0\n" +
100+
" type: array\n" +
101+
" items:\n" +
102+
" type: string\n";
97103
SerializationMatchers.assertEqualsToYaml(model, expected);
98104
}
99105
}

modules/swagger-core/src/test/java/io/swagger/v3/core/resolving/resources/BidimensionalArray.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
44
import io.swagger.v3.oas.annotations.media.ArraySchema;
55

6+
import javax.validation.constraints.Size;
67
import java.lang.annotation.Inherited;
78
import java.lang.annotation.Retention;
89
import java.lang.annotation.RetentionPolicy;
@@ -23,6 +24,9 @@ public static interface Foo<T> extends List<T> {
2324

2425
}
2526

27+
@Size(max = 2)
28+
public List<String> sized;
29+
2630
@Retention(RetentionPolicy.RUNTIME)
2731
@Inherited
2832
public static @interface MySizeAnnotation {

0 commit comments

Comments
 (0)