Update annotation name (#11531)

This commit is contained in:
ioanadinuit 2021-12-05 10:01:04 +02:00 committed by GitHub
parent 2c5982f9f9
commit 40669cc7c6
5 changed files with 10 additions and 10 deletions

View File

@ -5,12 +5,12 @@ import javax.validation.Payload;
import java.lang.annotation.*;
@Documented
@Constraint(validatedBy = {CamelcaseValidator.class})
@Constraint(validatedBy = {CapitalizedValidator.class})
@Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD})
@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;

View File

@ -4,11 +4,11 @@ import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
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;
}

View File

@ -8,7 +8,7 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import io.swagger.annotations.*;
import com.baeldung.openapi.petstore.validation.Camelcase;
import com.baeldung.openapi.petstore.validation.Capitalized;
{{#jdk8-no-delegate}}
{{#virtualService}}
import io.virtualan.annotation.ApiVirtual;

View File

@ -4,7 +4,7 @@ package {{package}};
{{/imports}}
import com.fasterxml.jackson.databind.annotation.*;
import com.fasterxml.jackson.annotation.*;
import com.baeldung.openapi.petstore.validation.Camelcase;
import com.baeldung.openapi.petstore.validation.Capitalized;
{{^supportJava6}}
import java.util.Objects;
import java.util.Arrays;

View File

@ -37,7 +37,7 @@ paths:
schema:
type: string
description: Tags to filter by
x-constraints: "@Camelcase(required = true)"
x-constraints: "@Capitalized(required = true)"
responses:
'200':
description: default response
@ -62,4 +62,4 @@ components:
format: int64
name:
type: string
x-constraints: "@Camelcase(required = true)"
x-constraints: "@Capitalized(required = true)"