Update annotation name (#11531)
This commit is contained in:
parent
2c5982f9f9
commit
40669cc7c6
|
@ -5,12 +5,12 @@ import javax.validation.Payload;
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
@Documented
|
@Documented
|
||||||
@Constraint(validatedBy = {CamelcaseValidator.class})
|
@Constraint(validatedBy = {CapitalizedValidator.class})
|
||||||
@Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
|
@Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Camelcase {
|
public @interface Capitalized {
|
||||||
|
|
||||||
String message() default "Name should be uppercase.";
|
String message() default "Name should be capitalized.";
|
||||||
|
|
||||||
boolean required() default true;
|
boolean required() default true;
|
||||||
|
|
|
@ -4,11 +4,11 @@ import javax.validation.ConstraintValidator;
|
||||||
import javax.validation.ConstraintValidatorContext;
|
import javax.validation.ConstraintValidatorContext;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class CamelcaseValidator implements ConstraintValidator<Camelcase, String> {
|
public class CapitalizedValidator implements ConstraintValidator<Capitalized, String> {
|
||||||
|
|
||||||
private Camelcase uppercaseAnnotation;
|
private Capitalized uppercaseAnnotation;
|
||||||
|
|
||||||
public void initialize(Camelcase constraintAnnotation) {
|
public void initialize(Capitalized constraintAnnotation) {
|
||||||
this.uppercaseAnnotation = constraintAnnotation;
|
this.uppercaseAnnotation = constraintAnnotation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ package {{package}};
|
||||||
{{#imports}}import {{import}};
|
{{#imports}}import {{import}};
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import com.baeldung.openapi.petstore.validation.Camelcase;
|
import com.baeldung.openapi.petstore.validation.Capitalized;
|
||||||
{{#jdk8-no-delegate}}
|
{{#jdk8-no-delegate}}
|
||||||
{{#virtualService}}
|
{{#virtualService}}
|
||||||
import io.virtualan.annotation.ApiVirtual;
|
import io.virtualan.annotation.ApiVirtual;
|
||||||
|
|
|
@ -4,7 +4,7 @@ package {{package}};
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
import com.fasterxml.jackson.databind.annotation.*;
|
import com.fasterxml.jackson.databind.annotation.*;
|
||||||
import com.fasterxml.jackson.annotation.*;
|
import com.fasterxml.jackson.annotation.*;
|
||||||
import com.baeldung.openapi.petstore.validation.Camelcase;
|
import com.baeldung.openapi.petstore.validation.Capitalized;
|
||||||
{{^supportJava6}}
|
{{^supportJava6}}
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
|
@ -37,7 +37,7 @@ paths:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
description: Tags to filter by
|
description: Tags to filter by
|
||||||
x-constraints: "@Camelcase(required = true)"
|
x-constraints: "@Capitalized(required = true)"
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: default response
|
description: default response
|
||||||
|
@ -62,4 +62,4 @@ components:
|
||||||
format: int64
|
format: int64
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
x-constraints: "@Camelcase(required = true)"
|
x-constraints: "@Capitalized(required = true)"
|
Loading…
Reference in New Issue