Merge pull request #10023 from kwoyke/JAVA-2400
JAVA-2400: Fix EmailAnnotationPlugin implementation
This commit is contained in:
commit
ecdc66253f
|
@ -10,6 +10,7 @@ import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import springfox.bean.validators.plugins.Validators;
|
import springfox.bean.validators.plugins.Validators;
|
||||||
|
import springfox.documentation.builders.StringElementFacetBuilder;
|
||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin;
|
import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin;
|
||||||
import springfox.documentation.spi.schema.contexts.ModelPropertyContext;
|
import springfox.documentation.spi.schema.contexts.ModelPropertyContext;
|
||||||
|
@ -30,8 +31,9 @@ public class EmailAnnotationPlugin implements ModelPropertyBuilderPlugin {
|
||||||
public void apply(ModelPropertyContext context) {
|
public void apply(ModelPropertyContext context) {
|
||||||
Optional<Email> email = annotationFromBean(context, Email.class);
|
Optional<Email> email = annotationFromBean(context, Email.class);
|
||||||
if (email.isPresent()) {
|
if (email.isPresent()) {
|
||||||
context.getBuilder().pattern(email.get().regexp());
|
context.getSpecificationBuilder().facetBuilder(StringElementFacetBuilder.class)
|
||||||
context.getBuilder().example("email@email.com");
|
.pattern(email.get().regexp());
|
||||||
|
context.getSpecificationBuilder().example("email@email.com");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue