Skip to content

Commit

Permalink
refs #4462 - exclude javax.validation annotations from container valu…
Browse files Browse the repository at this point in the history
…es processing
  • Loading branch information
frantuma committed Oct 24, 2023
1 parent 006b1ae commit 6d3602c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
if (annotatedType.getCtxAnnotations() != null) {
strippedCtxAnnotations.addAll(Arrays.stream(
annotatedType.getCtxAnnotations()).filter(
ass -> !ass.annotationType().getName().startsWith("io.swagger")
ass -> !ass.annotationType().getName().startsWith("io.swagger") && !ass.annotationType().getName().startsWith("javax.validation.constraints")
).collect(Collectors.toList()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ public void customAnnotationTest() throws Exception {
" maxItems: 2\n" +
" type: array\n" +
" items:\n" +
" type: string\n";
" type: string\n" +
" sized:\n" +
" maxItems: 2\n" +
" minItems: 0\n" +
" type: array\n" +
" items:\n" +
" type: string\n";
SerializationMatchers.assertEqualsToYaml(model, expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.ArraySchema;

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

}

@Size(max = 2)
public List<String> sized;

@Retention(RetentionPolicy.RUNTIME)
@Inherited
public static @interface MySizeAnnotation {
Expand Down

0 comments on commit 6d3602c

Please sign in to comment.