[4947][java]: adds support for validation of primitives in arrays (#17165)

* [4947][java]: adds support for validation of primitives in arrays

* [4947][java]: prevents generation '@Valid' for Object

* [4947][java]: test against different codegens and stick to primitive

* [4947][java]: code review

* [4947][java]: enhance getBeanValidation

* [4947][java]: adds email

* [4947][java]: removes unnecessary override

* [4947][java]: adds postProcessResponseWithProperty

* [4947][java]: adds missing import {{javaxPackage}}.validation.Valid

* [4947][java]: adds missing useBeanValidation

* [4947][java]: fix use rootJavaEEPackage for helidon
This commit is contained in:
Aliaksei 2023-12-11 13:55:38 +01:00 committed by GitHub
parent d4d5196907
commit 809b3331a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
575 changed files with 1982 additions and 843 deletions

View File

@ -224,6 +224,8 @@ public interface CodegenConfig {
void postProcessModelProperty(CodegenModel model, CodegenProperty property);
void postProcessResponseWithProperty(CodegenResponse response, CodegenProperty property);
void postProcessParameter(CodegenParameter parameter);
String modelFilename(String templateName, String modelName);

View File

@ -998,6 +998,12 @@ public class DefaultCodegen implements CodegenConfig {
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
}
// override to post-process any response
@Override
@SuppressWarnings("unused")
public void postProcessResponseWithProperty(CodegenResponse response, CodegenProperty property) {
}
// override to post-process any parameters
@Override
@SuppressWarnings("unused")
@ -4999,6 +5005,7 @@ public class DefaultCodegen implements CodegenConfig {
r.simpleType = true;
}
postProcessResponseWithProperty(r, cp);
return r;
}

View File

@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import io.swagger.models.Model;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
@ -34,7 +33,9 @@ import io.swagger.v3.parser.util.SchemaTypeUtil;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringEscapeUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
import org.openapitools.codegen.languages.features.DocumentationProviderFeatures;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap;
@ -930,7 +931,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
Schema<?> target = ModelUtils.isGenerateAliasAsModel() ? p : schema;
if (ModelUtils.isArraySchema(target)) {
Schema<?> items = getSchemaItems((ArraySchema) schema);
return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">";
return getSchemaType(target) + "<" + getBeanValidation(items) + getTypeDeclaration(items) + ">";
} else if (ModelUtils.isMapSchema(target)) {
// Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines
// additionalproperties: true
@ -945,6 +946,128 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
return super.getTypeDeclaration(target);
}
/**
* This method stand for resolve bean validation for container(array, set).
* Return empty if there's no bean validation for requested type or prop useBeanValidation false or missed.
*
* @param items type
* @return BeanValidation for declared type in container(array, set)
*/
private String getBeanValidation(Schema<?> items) {
if (Boolean.FALSE.equals(additionalProperties.getOrDefault(BeanValidationFeatures.USE_BEANVALIDATION, Boolean.FALSE))) {
return "";
}
if (ModelUtils.isTypeObjectSchema(items)) {
// prevents generation '@Valid' for Object
return "";
}
if (items.get$ref() != null) {
return "@Valid ";
}
if (ModelUtils.isStringSchema(items)) {
return getStringBeanValidation(items);
}
if (ModelUtils.isNumberSchema(items)) {
return getNumberBeanValidation(items);
}
if (ModelUtils.isIntegerSchema(items)) {
return getIntegerBeanValidation(items);
}
return "";
}
private String getIntegerBeanValidation(Schema<?> items) {
if (items.getMinimum() != null && items.getMaximum() != null) {
return String.format(Locale.ROOT, "@Min(%s) @Max(%s)", items.getMinimum(), items.getMaximum());
}
if (items.getMinimum() != null) {
return String.format(Locale.ROOT, "@Min(%s)", items.getMinimum());
}
if (items.getMaximum() != null) {
return String.format(Locale.ROOT, "@Max(%s)", items.getMaximum());
}
return "";
}
private String getNumberBeanValidation(Schema<?> items) {
if (items.getMinimum() != null && items.getMaximum() != null) {
return String.format(Locale.ROOT, "@DecimalMin(value = \"%s\", inclusive = %s) @DecimalMax(value = \"%s\", inclusive = %s)",
items.getMinimum(),
Optional.ofNullable(items.getExclusiveMinimum()).orElse(Boolean.FALSE),
items.getMaximum(),
Optional.ofNullable(items.getExclusiveMaximum()).orElse(Boolean.FALSE));
}
if (items.getMinimum() != null) {
return String.format(Locale.ROOT, "@DecimalMin( value = \"%s\", inclusive = %s)",
items.getMinimum(),
Optional.ofNullable(items.getExclusiveMinimum()).orElse(Boolean.FALSE));
}
if (items.getMaximum() != null) {
return String.format(Locale.ROOT, "@DecimalMax( value = \"%s\", inclusive = %s)",
items.getMaximum(),
Optional.ofNullable(items.getExclusiveMaximum()).orElse(Boolean.FALSE));
}
return "";
}
private String getStringBeanValidation(Schema<?> items) {
String validations = "";
if (ModelUtils.isByteArraySchema(items) || ModelUtils.isBinarySchema(items)) {
return validations;
}
if (StringUtils.isNotEmpty(items.getPattern())) {
final String pattern = escapeUnsafeCharacters(
StringEscapeUtils.unescapeJava(
StringEscapeUtils.escapeJava(items.getPattern())
.replace("\\/", "/"))
.replaceAll("[\\t\\n\\r]", " ")
.replace("\\", "\\\\")
.replace("\"", "\\\""));
validations = String.format(Locale.ROOT, "@Pattern(regexp = \"%s\")", pattern);
}
if (ModelUtils.isEmailSchema(items)) {
return String.join("", "@Email ");
}
if (ModelUtils.isDecimalSchema(items)) {
return String.join("", validations, getNumberBeanValidation(items));
}
if (items.getMinLength() != null && items.getMaxLength() != null) {
return String.join("",
validations,
String.format(Locale.ROOT, "@Size(min = %d, max = %d)", items.getMinLength(), items.getMaxLength()));
}
if (items.getMinLength() != null) {
return String.join("",
validations,
String.format(Locale.ROOT, "@Size(min = %d)", items.getMinLength()));
}
if (items.getMaxLength() != null) {
return String.join("",
validations,
String.format(Locale.ROOT, "@Size(max = %d)", items.getMaxLength()));
}
return validations;
}
@Override
public String getAlias(String name) {
if (typeAliases != null && typeAliases.containsKey(name)) {
@ -1511,6 +1634,21 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
}
}
public void postProcessResponseWithProperty(CodegenResponse response, CodegenProperty property) {
if (response == null || property == null || response.dataType == null || property.dataType == null) {
return;
}
// the response data types should not contains a bean validation annotation.
if (property.dataType.contains("@")) {
property.dataType = property.dataType.replaceAll("(?:(?i)@[a-z0-9]*+\\s*)*+", "");
}
// the response data types should not contains a bean validation annotation.
if (response.dataType.contains("@")) {
response.dataType = response.dataType.replaceAll("(?:(?i)@[a-z0-9]*+\\s*)*+", "");
}
}
@Override
public ModelsMap postProcessModels(ModelsMap objs) {
// recursively add import for mapping one type to multiple imports

View File

@ -1420,119 +1420,6 @@ public class SpringCodegen extends AbstractJavaCodegen
this.requestMappingMode = requestMappingMode;
}
@Override
public CodegenParameter fromParameter( final Parameter parameter, final Set<String> imports ) {
CodegenParameter codegenParameter = super.fromParameter( parameter, imports );
if(!isListOrSet(codegenParameter)){
return codegenParameter;
}
codegenParameter.datatypeWithEnum = replaceBeanValidationCollectionType(codegenParameter.items, codegenParameter.datatypeWithEnum );
codegenParameter.dataType = replaceBeanValidationCollectionType(codegenParameter.items, codegenParameter.dataType );
return codegenParameter;
}
@Override
public CodegenProperty fromProperty( String name, Schema p, boolean required, boolean schemaIsFromAdditionalProperties ) {
CodegenProperty codegenProperty = super.fromProperty( name, p, required, schemaIsFromAdditionalProperties );
if(!isListOrSet(codegenProperty)){
return codegenProperty;
}
codegenProperty.datatypeWithEnum = replaceBeanValidationCollectionType(codegenProperty.items, codegenProperty.datatypeWithEnum );
codegenProperty.dataType = replaceBeanValidationCollectionType(codegenProperty.items, codegenProperty.dataType );
return codegenProperty;
}
// The default validation applied for non-container and non-map types is sufficient for the SpringCodegen.
// Maps are very complex for bean validation, so it's currently not supported.
private static boolean isListOrSet(CodegenProperty codegenProperty) {
return codegenProperty.isContainer && !codegenProperty.isMap;
}
// The default validation applied for non-container and non-map types is sufficient for the SpringCodegen.
// Maps are very complex for bean validation, so it's currently not supported.
private static boolean isListOrSet(CodegenParameter codegenParameter) {
return codegenParameter.isContainer && !codegenParameter.isMap;
}
private String replaceBeanValidationCollectionType(CodegenProperty codegenProperty, String dataType) {
if (!useBeanValidation() || isResponseType(codegenProperty)) {
return dataType;
}
if (StringUtils.isEmpty(dataType) || dataType.contains("@Valid")) {
return dataType;
}
if (codegenProperty.isModel) {
return dataType.replace("<", "<@Valid ");
}
String beanValidation = getPrimitiveBeanValidation(codegenProperty);
if (beanValidation == null) {
return dataType;
}
return dataType.replace("<", "<" + beanValidation + " ");
}
/**
* This method should be in sync with beanValidationCore.mustache
* @param codegenProperty the code property
* @return the bean validation semantic for container primitive types
*/
private String getPrimitiveBeanValidation(CodegenProperty codegenProperty) {
if (StringUtils.isNotEmpty(codegenProperty.pattern) && !codegenProperty.isByteArray) {
return "@Pattern(regexp = \""+codegenProperty.pattern+"\")";
}
if (codegenProperty.minLength != null && codegenProperty.maxLength != null) {
return "@Size(min = " + codegenProperty.minLength + ", max = " + codegenProperty.maxLength + ")";
}
if (codegenProperty.minLength != null) {
return "@Size(min = " + codegenProperty.minLength + ")";
}
if (codegenProperty.maxLength != null) {
return "@Size(max = " + codegenProperty.maxLength + ")";
}
if (codegenProperty.isEmail) {
return "@" + additionalProperties.get(JAVAX_PACKAGE)+".validation.constraints.Email";
}
if (codegenProperty.isLong || codegenProperty.isInteger) {
if (StringUtils.isNotEmpty(codegenProperty.minimum) && StringUtils.isNotEmpty(codegenProperty.maximum)) {
return "@Min("+codegenProperty.minimum+") @Max("+codegenProperty.maximum+")";
}
if (StringUtils.isNotEmpty(codegenProperty.minimum)) {
return "@Min("+codegenProperty.minimum+")";
}
if (StringUtils.isNotEmpty(codegenProperty.maximum)) {
return "@Max("+codegenProperty.maximum+")";
}
}
if (StringUtils.isNotEmpty(codegenProperty.minimum) && StringUtils.isNotEmpty(codegenProperty.maximum)) {
return "@DecimalMin(value = \""+codegenProperty.minimum+"\", inclusive = false) @DecimalMax(value = \""+codegenProperty.maximum+"\", inclusive = false)";
}
if (StringUtils.isNotEmpty(codegenProperty.minimum)) {
return "@DecimalMin( value = \""+codegenProperty.minimum+"\", inclusive = false)";
}
if (StringUtils.isNotEmpty(codegenProperty.maximum)) {
return "@DecimalMax( value = \""+codegenProperty.maximum+"\", inclusive = false)";
}
return null;
}
public void setResourceFolder( String resourceFolder ) {
this.resourceFolder = resourceFolder;
}
@ -1540,16 +1427,4 @@ public class SpringCodegen extends AbstractJavaCodegen
public String getResourceFolder() {
return resourceFolder;
}
// This should prevent, that the response data types not contains a @Valid annotation.
// However, the side effect is that attributes with response as name are also affected.
private static boolean isResponseType(CodegenProperty codegenProperty) {
return codegenProperty.baseName.toLowerCase(Locale.ROOT).contains("response");
}
// SPRING_HTTP_INTERFACE does not support bean validation.
public boolean useBeanValidation() {
return useBeanValidation && !SPRING_HTTP_INTERFACE.equals(library);
}
}

View File

@ -27,6 +27,7 @@ import java.io.IOException;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#performBeanValidation}}
import {{javaxPackage}}.validation.ConstraintViolation;

View File

@ -32,6 +32,11 @@ import io.swagger.v3.oas.annotations.responses.*;
import io.swagger.v3.oas.annotations.security.*;
{{/swagger2AnnotationLibrary}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -17,6 +17,11 @@ import okhttp3.MultipartBody;
{{#imports}}import {{import}};
{{/imports}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -19,6 +19,7 @@ import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
{{#operations}}

View File

@ -18,6 +18,7 @@ import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
{{#operations}}

View File

@ -22,6 +22,7 @@ import java.util.Map;
import java.util.List;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
@Path("{{commonPath}}")
@RequestScoped

View File

@ -7,6 +7,7 @@ import java.io.Serializable;
{{/serializableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#models}}
{{#model}}{{#description}}

View File

@ -20,6 +20,7 @@ import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
{{#operations}}

View File

@ -20,6 +20,7 @@ import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
{{#operations}}

View File

@ -13,6 +13,10 @@ import {{package}}.NotFoundException;
import java.io.InputStream;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
import {{javaxPackage}}.enterprise.context.RequestScoped;
import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;

View File

@ -12,6 +12,10 @@ import java.util.List;
import java.io.InputStream;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;

View File

@ -9,6 +9,7 @@ import java.io.Serializable;
{{/serializableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#models}}
{{#model}}

View File

@ -9,6 +9,7 @@ import java.io.Serializable;
{{/serializableModel}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#models}}
{{#model}}

View File

@ -16,6 +16,7 @@ import java.util.concurrent.CompletableFuture;
{{/supportAsync}}
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{>generatedAnnotation}}
{{#operations}}

View File

@ -32,6 +32,7 @@ import java.util.concurrent.CompletableFuture;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
import com.typesafe.config.Config;
{{/useBeanValidation}}

View File

@ -26,6 +26,7 @@ import java.util.concurrent.CompletableFuture;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#operations}}

View File

@ -1,6 +1,7 @@
import java.util.Objects;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
/**
* {{description}}{{^description}}{{classname}}{{/description}}

View File

@ -2,6 +2,10 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
{{#useBeanValidation}}
import {{rootJavaEEPackage}}.validation.constraints.*;
import {{rootJavaEEPackage}}.validation.Valid;
{{/useBeanValidation}}
{{#models}}
{{#model}}{{#isEnum}}
{{>enumOuterClass}}{{/isEnum}}{{^isEnum}}

View File

@ -0,0 +1,410 @@
/*
* Copyright 2022 OpenAPI-Generator Contributors (https://openapi-generator.tech)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openapitools.codegen.java;
import io.swagger.parser.OpenAPIParser;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.java.assertions.JavaFileAssert;
import org.openapitools.codegen.languages.*;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
public class JavaValidationArrayPrimitivesTest {
private static Consumer<Map<String, File>> assertWithValidationWithoutJsonNullable() {
return files -> JavaFileAssert.assertThat(files.get("Foo.java"))
.isNormalClass()
.hasProperty("stringPattern")
.withType("Set<@Pattern(regexp = \"[a-z]\") String>")
.toType()
.hasProperty("stringMaxMinLength")
.withType("Set<@Size(min = 1, max = 10) String>")
.toType()
.hasProperty("stringMinLength")
.withType("List<@Size(min = 1) String>")
.toType()
.hasProperty("stringMaxLength")
.withType("Set<@Size(max = 1) String>")
.toType()
.hasProperty("stringEmail")
.withType("List<@Email String>")
.toType()
.hasProperty("intMinMax")
.withType("List<@Min(1) @Max(10) Integer>")
.toType()
.hasProperty("intMin")
.withType("List<@Min(1) Integer>")
.toType()
.hasProperty("intMax")
.withType("List<@Max(10) Integer>")
.toType()
.hasProperty("numberMinMax")
.withType("List<@DecimalMin(value = \"1\", inclusive = false) @DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("numberMin")
.withType("List<@DecimalMin(value = \"1\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("numberMax")
.withType("List<@DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("stringPatternWithMin")
.withType("Set<@Pattern(regexp = \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\") @Size(min = 10) String>")
.toType()
.hasProperty("stringPatternNullable")
.withType("Set<@Pattern(regexp = \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\") String>")
.toType()
.hasProperty("stringMaxMinLengthNullable")
.withType("Set<@Size(min = 1, max = 10) String>")
.toType()
.hasProperty("stringMinLengthNullable")
.withType("List<@Size(min = 1) String>")
.toType()
.hasProperty("stringMaxLengthNullable")
.withType("Set<@Size(max = 1) String>")
.toType()
.hasProperty("stringNumbers")
.withType("Set<@DecimalMin(value = \"1\", inclusive = false) @DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("intMinMaxNullable")
.withType("List<@Min(1) @Max(10) Integer>")
.toType()
.hasProperty("intMinNullable")
.withType("List<@Min(1) Integer>")
.toType()
.hasProperty("intMaxNullable")
.withType("List<@Max(10) Integer>")
.toType()
.hasProperty("numberMinMaxNullable")
.withType("List<@DecimalMin(value = \"1\", inclusive = false) @DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("numberMinNullable")
.withType("List<@DecimalMin(value = \"1\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("numberMaxNullable")
.withType("List<@DecimalMax(value = \"10\", inclusive = true) BigDecimal>")
.toType();
}
private static Consumer<Map<String, File>> assertWithValidationWithJsonNullable() {
return files -> JavaFileAssert.assertThat(files.get("Foo.java"))
.isNormalClass()
.hasProperty("stringPattern")
.withType("Set<@Pattern(regexp = \"[a-z]\") String>")
.toType()
.hasProperty("stringMaxMinLength")
.withType("Set<@Size(min = 1, max = 10) String>")
.toType()
.hasProperty("stringMinLength")
.withType("List<@Size(min = 1) String>")
.toType()
.hasProperty("stringMaxLength")
.withType("Set<@Size(max = 1) String>")
.toType()
.hasProperty("stringEmail")
.withType("List<@Email String>")
.toType()
.hasProperty("intMinMax")
.withType("List<@Min(1) @Max(10) Integer>")
.toType()
.hasProperty("intMin")
.withType("List<@Min(1) Integer>")
.toType()
.hasProperty("intMax")
.withType("List<@Max(10) Integer>")
.toType()
.hasProperty("numberMinMax")
.withType("List<@DecimalMin(value = \"1\", inclusive = false) @DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("numberMin")
.withType("List<@DecimalMin(value = \"1\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("numberMax")
.withType("List<@DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("stringPatternWithMin")
.withType("JsonNullable<Set<@Pattern(regexp = \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\") @Size(min = 10) String>>")
.toType()
.hasProperty("stringPatternNullable")
.withType("JsonNullable<Set<@Pattern(regexp = \"^\\\\d{3}-\\\\d{2}-\\\\d{4}$\") String>>")
.toType()
.hasProperty("stringMaxMinLengthNullable")
.withType("JsonNullable<Set<@Size(min = 1, max = 10) String>>")
.toType()
.hasProperty("stringMinLengthNullable")
.withType("JsonNullable<List<@Size(min = 1) String>>")
.toType()
.hasProperty("stringMaxLengthNullable")
.withType("JsonNullable<Set<@Size(max = 1) String>>")
.toType()
.hasProperty("stringNumbers")
.withType("Set<@DecimalMin(value = \"1\", inclusive = false) @DecimalMax(value = \"10\", inclusive = false) BigDecimal>")
.toType()
.hasProperty("intMinMaxNullable")
.withType("JsonNullable<List<@Min(1) @Max(10) Integer>>")
.toType()
.hasProperty("intMinNullable")
.withType("JsonNullable<List<@Min(1) Integer>>")
.toType()
.hasProperty("intMaxNullable")
.withType("JsonNullable<List<@Max(10) Integer>>")
.toType()
.hasProperty("numberMinMaxNullable")
.withType("JsonNullable<List<@DecimalMin(value = \"1\", inclusive = false) @DecimalMax(value = \"10\", inclusive = false) BigDecimal>>")
.toType()
.hasProperty("numberMinNullable")
.withType("JsonNullable<List<@DecimalMin(value = \"1\", inclusive = false) BigDecimal>>")
.toType()
.hasProperty("numberMaxNullable")
.withType("JsonNullable<List<@DecimalMax(value = \"10\", inclusive = true) BigDecimal>>")
.toType();
}
@DataProvider(name = "javaCodegensUsedBeanValidation")
public static Object[][] javaCodegensUsedBeanValidation() {
return new Object[][]{
{new JavaCXFClientCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaClientCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaPlayFrameworkCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaMicronautClientCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaMicronautServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaJAXRSCXFCDIServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaCXFExtServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaResteasyServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaJAXRSSpecServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaJerseyServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new JavaResteasyEapServerCodegen(), assertWithValidationWithoutJsonNullable()},
{new SpringCodegen(), assertWithValidationWithJsonNullable()}
};
}
@Test(dataProvider = "javaCodegensUsedBeanValidation")
public void shouldAddValidAnnotationIntoCollectionWhenBeanValidationIsEnabled_issue4947(final AbstractJavaCodegen codegen, final Consumer<Map<String, File>> asserts) throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
final OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/bugs/issue_4947.yaml", null, new ParseOptions()).getOpenAPI();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(SpringCodegen.USE_BEANVALIDATION, "true");
codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.model");
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.controller");
final ClientOptInput input = new ClientOptInput()
.openAPI(openAPI)
.config(codegen);
final DefaultGenerator generator = new DefaultGenerator();
final Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
asserts.accept(files);
}
private static Consumer<Map<String, File>> assertWithoutValidationWithoutJsonNullable() {
return files -> JavaFileAssert.assertThat(files.get("Foo.java"))
.isNormalClass()
.hasProperty("stringPattern")
.withType("Set<String>")
.toType()
.hasProperty("stringMaxMinLength")
.withType("Set<String>")
.toType()
.hasProperty("stringMinLength")
.withType("List<String>")
.toType()
.hasProperty("stringMaxLength")
.withType("Set<String>")
.toType()
.hasProperty("stringEmail")
.withType("List<String>")
.toType()
.hasProperty("intMinMax")
.withType("List<Integer>")
.toType()
.hasProperty("intMin")
.withType("List<Integer>")
.toType()
.hasProperty("intMax")
.withType("List<Integer>")
.toType()
.hasProperty("numberMinMax")
.withType("List<BigDecimal>")
.toType()
.hasProperty("numberMin")
.withType("List<BigDecimal>")
.toType()
.hasProperty("numberMax")
.withType("List<BigDecimal>")
.toType()
.hasProperty("stringPatternWithMin")
.withType("Set<String>")
.toType()
.hasProperty("stringPatternNullable")
.withType("Set<String>")
.toType()
.hasProperty("stringMaxMinLengthNullable")
.withType("Set<String>")
.toType()
.hasProperty("stringMinLengthNullable")
.withType("List<String>")
.toType()
.hasProperty("stringMaxLengthNullable")
.withType("Set<String>")
.toType()
.hasProperty("intMinMaxNullable")
.withType("List<Integer>")
.toType()
.hasProperty("intMinNullable")
.withType("List<Integer>")
.toType()
.hasProperty("intMaxNullable")
.withType("List<Integer>")
.toType()
.hasProperty("numberMinMaxNullable")
.withType("List<BigDecimal>")
.toType()
.hasProperty("numberMinNullable")
.withType("List<BigDecimal>")
.toType()
.hasProperty("numberMaxNullable")
.withType("List<BigDecimal>")
.toType();
}
private static Consumer<Map<String, File>> assertWithoutValidationWithJsonNullable() {
return files -> JavaFileAssert.assertThat(files.get("Foo.java"))
.isNormalClass()
.hasProperty("stringPattern")
.withType("Set<String>")
.toType()
.hasProperty("stringMaxMinLength")
.withType("Set<String>")
.toType()
.hasProperty("stringMinLength")
.withType("List<String>")
.toType()
.hasProperty("stringMaxLength")
.withType("Set<String>")
.toType()
.hasProperty("stringEmail")
.withType("List<String>")
.toType()
.hasProperty("intMinMax")
.withType("List<Integer>")
.toType()
.hasProperty("intMin")
.withType("List<Integer>")
.toType()
.hasProperty("intMax")
.withType("List<Integer>")
.toType()
.hasProperty("numberMinMax")
.withType("List<BigDecimal>")
.toType()
.hasProperty("numberMin")
.withType("List<BigDecimal>")
.toType()
.hasProperty("numberMax")
.withType("List<BigDecimal>")
.toType()
.hasProperty("stringPatternWithMin")
.withType("JsonNullable<Set<String>>")
.toType()
.hasProperty("stringPatternNullable")
.withType("JsonNullable<Set<String>>")
.toType()
.hasProperty("stringMaxMinLengthNullable")
.withType("JsonNullable<Set<String>>")
.toType()
.hasProperty("stringMinLengthNullable")
.withType("JsonNullable<List<String>>")
.toType()
.hasProperty("stringMaxLengthNullable")
.withType("JsonNullable<Set<String>>")
.toType()
.hasProperty("intMinMaxNullable")
.withType("JsonNullable<List<Integer>>")
.toType()
.hasProperty("intMinNullable")
.withType("JsonNullable<List<Integer>>")
.toType()
.hasProperty("intMaxNullable")
.withType("JsonNullable<List<Integer>>")
.toType()
.hasProperty("numberMinMaxNullable")
.withType("JsonNullable<List<BigDecimal>>")
.toType()
.hasProperty("numberMinNullable")
.withType("JsonNullable<List<BigDecimal>>")
.toType()
.hasProperty("numberMaxNullable")
.withType("JsonNullable<List<BigDecimal>>")
.toType();
}
@DataProvider(name = "javaCodegensNotUsedBeanValidation")
public static Object[][] javaCodegensNotUsedBeanValidation() {
return new Object[][]{
{new JavaCXFClientCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaClientCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaPlayFrameworkCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaMicronautClientCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaMicronautServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaJAXRSCXFCDIServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaCXFExtServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaResteasyServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaJAXRSSpecServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaJerseyServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new JavaResteasyEapServerCodegen(), assertWithoutValidationWithoutJsonNullable()},
{new SpringCodegen(), assertWithoutValidationWithJsonNullable()}
};
}
@Test(dataProvider = "javaCodegensNotUsedBeanValidation")
public void shouldNotAddValidAnnotationIntoCollectionWhenBeanValidationIsNotEnabled_issue4947(final AbstractJavaCodegen codegen, final Consumer<Map<String, File>> asserts) throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
final OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/bugs/issue_4947.yaml", null, new ParseOptions()).getOpenAPI();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.model");
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.controller");
codegen.additionalProperties().put(SpringCodegen.USE_BEANVALIDATION, "false");
final ClientOptInput input = new ClientOptInput()
.openAPI(openAPI)
.config(codegen);
final DefaultGenerator generator = new DefaultGenerator();
final Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
asserts.accept(files);
}
}

View File

@ -946,7 +946,7 @@ public class SpringCodegenTest {
.withType( "Map<String, Object>" )
.toType()
.hasProperty("response")
.withType( "JsonNullable<Set<ResponseTest2>>" )
.withType( "JsonNullable<Set<@Valid ResponseTest2>>" )
.toType()
.hasProperty("nullableDtos")
.withType( "JsonNullable<Set<@Valid ResponseTest2>>" )

View File

@ -0,0 +1,176 @@
openapi: 3.0.3
info:
title: Test Issue
version: v1
paths:
/test:
get:
responses:
'200':
description: default response
content:
'*/*':
schema:
$ref: '#/components/schemas/Foo'
components:
schemas:
Foo:
type: object
properties:
stringPattern:
type: array
uniqueItems: true
items:
type: string
pattern: "[a-z]"
stringMaxMinLength:
type: array
uniqueItems: true
items:
type: string
minLength: 1
maxLength: 10
maxItems: 10
stringMinLength:
type: array
items:
type: string
minLength: 1
maxItems: 10
stringMaxLength:
type: array
uniqueItems: true
items:
type: string
maxLength: 1
maxItems: 10
stringEmail:
type: array
items:
type: string
format: email
intMinMax:
type: array
items:
type: integer
minimum: 1
maximum: 10
intMin:
type: array
items:
type: integer
minimum: 1
intMax:
type: array
items:
type: integer
maximum: 10
numberMinMax:
type: array
items:
type: number
minimum: 1
maximum: 10
numberMin:
type: array
items:
type: number
minimum: 1
numberMax:
type: array
items:
type: number
maximum: 10
stringPatternWithMin:
nullable: true
type: array
uniqueItems: true
items:
type: string
minLength: 10
pattern: '^\d{3}-\d{2}-\d{4}$'
stringPatternNullable:
nullable: true
type: array
uniqueItems: true
items:
type: string
pattern: '^\d{3}-\d{2}-\d{4}$'
stringMaxMinLengthNullable:
nullable: true
type: array
uniqueItems: true
items:
type: string
minLength: 1
maxLength: 10
maxItems: 10
stringMinLengthNullable:
nullable: true
type: array
items:
type: string
minLength: 1
maxItems: 10
stringMaxLengthNullable:
nullable: true
type: array
uniqueItems: true
items:
type: string
maxLength: 1
maxItems: 10
stringNumbers:
type: array
uniqueItems: true
items:
type: string
format: number
minimum: 1
maximum: 10
maxItems: 10
stringEmailNullable:
nullable: true
type: array
items:
type: string
format: email
intMinMaxNullable:
nullable: true
type: array
items:
type: integer
minimum: 1
maximum: 10
intMinNullable:
nullable: true
type: array
items:
type: integer
minimum: 1
intMaxNullable:
nullable: true
type: array
items:
type: integer
maximum: 10
numberMinMaxNullable:
nullable: true
type: array
items:
type: number
minimum: 1
maximum: 10
numberMinNullable:
nullable: true
type: array
items:
type: number
minimum: 1
numberMaxNullable:
nullable: true
type: array
items:
type: number
maximum: 10
exclusiveMaximum: true

View File

@ -77,7 +77,7 @@ Creates list of users with given input array
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **_body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **_body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
@ -99,7 +99,7 @@ Creates list of users with given input array
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **_body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **_body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |

View File

@ -10,7 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayOfString** | `List&lt;String&gt;` | | [optional property]
**arrayArrayOfInteger** | `List&lt;List&lt;Long&gt;&gt;` | | [optional property]
**arrayArrayOfModel** | `List&lt;List&lt;ReadOnlyFirst&gt;&gt;` | | [optional property]
**arrayArrayOfModel** | `List&lt;List&lt;@Valid ReadOnlyFirst&gt;&gt;` | | [optional property]

View File

@ -48,7 +48,7 @@ public interface UserApi {
*/
@Post(uri="/user/createWithArray")
Mono<Void> createUsersWithArrayInput(
@Body @NotNull List<User> _body
@Body @NotNull List<@Valid User> _body
);
/**
@ -58,7 +58,7 @@ public interface UserApi {
*/
@Post(uri="/user/createWithList")
Mono<Void> createUsersWithListInput(
@Body @NotNull List<User> _body
@Body @NotNull List<@Valid User> _body
);
/**

View File

@ -44,7 +44,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger = null;
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel = null;
public ArrayTest() {
}
@ -108,12 +108,12 @@ public class ArrayTest {
this.arrayArrayOfInteger = arrayArrayOfInteger;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<>();
}
@ -128,13 +128,13 @@ public class ArrayTest {
@Nullable
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -40,7 +40,7 @@ public class FileSchemaTestClass {
private ModelFile _file;
public static final String JSON_PROPERTY_FILES = "files";
private List<ModelFile> files = null;
private List<@Valid ModelFile> files = null;
public FileSchemaTestClass() {
}
@ -67,7 +67,7 @@ public class FileSchemaTestClass {
this._file = _file;
}
public FileSchemaTestClass files(List<ModelFile> files) {
public FileSchemaTestClass files(List<@Valid ModelFile> files) {
this.files = files;
return this;
}
@ -87,13 +87,13 @@ public class FileSchemaTestClass {
@Nullable
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<ModelFile> getFiles() {
public List<@Valid ModelFile> getFiles() {
return files;
}
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFiles(List<ModelFile> files) {
public void setFiles(List<@Valid ModelFile> files) {
this.files = files;
}

View File

@ -57,7 +57,7 @@ public class Pet {
private Set<String> photoUrls = new LinkedHashSet<>();
public static final String JSON_PROPERTY_TAGS = "tags";
private List<Tag> tags = null;
private List<@Valid Tag> tags = null;
/**
* pet status in the store
@ -193,7 +193,7 @@ public class Pet {
this.photoUrls = photoUrls;
}
public Pet tags(List<Tag> tags) {
public Pet tags(List<@Valid Tag> tags) {
this.tags = tags;
return this;
}
@ -213,13 +213,13 @@ public class Pet {
@Nullable
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Tag> getTags() {
public List<@Valid Tag> getTags() {
return tags;
}
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}

View File

@ -9,7 +9,7 @@
|------------ | ------------- | ------------- | -------------|
|**arrayOfString** | **List&lt;String&gt;** | | [optional] |
|**arrayArrayOfInteger** | **List&lt;List&lt;Long&gt;&gt;** | | [optional] |
|**arrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional] |
|**arrayArrayOfModel** | **List&lt;List&lt;@Valid ReadOnlyFirst&gt;&gt;** | | [optional] |

View File

@ -81,7 +81,7 @@ api.createUsersWithArrayInput()
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
### Return type
@ -121,7 +121,7 @@ api.createUsersWithListInput()
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
### Return type

View File

@ -28,6 +28,9 @@ import io.restassured.common.mapper.TypeRef;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -35,6 +35,9 @@ import io.restassured.common.mapper.TypeRef;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -27,6 +27,9 @@ import io.restassured.common.mapper.TypeRef;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -30,6 +30,9 @@ import io.restassured.common.mapper.TypeRef;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -27,6 +27,9 @@ import io.restassured.common.mapper.TypeRef;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -28,6 +28,9 @@ import io.restassured.common.mapper.TypeRef;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;
@ -204,10 +207,10 @@ public class UserApi {
}
/**
* @param body (List&lt;User&gt;) List of user object (required)
* @param body (List&lt;@Valid User&gt;) List of user object (required)
* @return operation
*/
public CreateUsersWithArrayInputOper body(List<User> body) {
public CreateUsersWithArrayInputOper body(List<@Valid User> body) {
reqSpec.setBody(body);
return this;
}
@ -265,10 +268,10 @@ public class UserApi {
}
/**
* @param body (List&lt;User&gt;) List of user object (required)
* @param body (List&lt;@Valid User&gt;) List of user object (required)
* @return operation
*/
public CreateUsersWithListInputOper body(List<User> body) {
public CreateUsersWithListInputOper body(List<@Valid User> body) {
reqSpec.setBody(body);
return this;
}

View File

@ -47,7 +47,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger;
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
public ArrayTest() {
}
@ -123,13 +123,13 @@ public class ArrayTest {
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<>();
}
@ -147,14 +147,14 @@ public class ArrayTest {
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -43,7 +43,7 @@ public class FileSchemaTestClass {
private ModelFile _file;
public static final String JSON_PROPERTY_FILES = "files";
private List<ModelFile> files;
private List<@Valid ModelFile> files;
public FileSchemaTestClass() {
}
@ -76,7 +76,7 @@ public class FileSchemaTestClass {
}
public FileSchemaTestClass files(List<ModelFile> files) {
public FileSchemaTestClass files(List<@Valid ModelFile> files) {
this.files = files;
return this;
@ -100,14 +100,14 @@ public class FileSchemaTestClass {
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<ModelFile> getFiles() {
public List<@Valid ModelFile> getFiles() {
return files;
}
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFiles(List<ModelFile> files) {
public void setFiles(List<@Valid ModelFile> files) {
this.files = files;
}

View File

@ -60,7 +60,7 @@ public class Pet {
private Set<String> photoUrls = new LinkedHashSet<>();
public static final String JSON_PROPERTY_TAGS = "tags";
private List<Tag> tags;
private List<@Valid Tag> tags;
/**
* pet status in the store
@ -225,7 +225,7 @@ public class Pet {
}
public Pet tags(List<Tag> tags) {
public Pet tags(List<@Valid Tag> tags) {
this.tags = tags;
return this;
@ -249,14 +249,14 @@ public class Pet {
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Tag> getTags() {
public List<@Valid Tag> getTags() {
return tags;
}
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}

View File

@ -9,7 +9,7 @@
|------------ | ------------- | ------------- | -------------|
|**arrayOfString** | **List&lt;String&gt;** | | [optional] |
|**arrayArrayOfInteger** | **List&lt;List&lt;Long&gt;&gt;** | | [optional] |
|**arrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional] |
|**arrayArrayOfModel** | **List&lt;List&lt;@Valid ReadOnlyFirst&gt;&gt;** | | [optional] |

View File

@ -81,7 +81,7 @@ api.createUsersWithArrayInput()
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
### Return type
@ -121,7 +121,7 @@ api.createUsersWithListInput()
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
### Return type

View File

@ -28,6 +28,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -35,6 +35,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -27,6 +27,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -30,6 +30,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -27,6 +27,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;

View File

@ -28,6 +28,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;
@ -205,10 +208,10 @@ public class UserApi {
}
/**
* @param body (List&lt;User&gt;) List of user object (required)
* @param body (List&lt;@Valid User&gt;) List of user object (required)
* @return operation
*/
public CreateUsersWithArrayInputOper body(List<User> body) {
public CreateUsersWithArrayInputOper body(List<@Valid User> body) {
reqSpec.setBody(body);
return this;
}
@ -266,10 +269,10 @@ public class UserApi {
}
/**
* @param body (List&lt;User&gt;) List of user object (required)
* @param body (List&lt;@Valid User&gt;) List of user object (required)
* @return operation
*/
public CreateUsersWithListInputOper body(List<User> body) {
public CreateUsersWithListInputOper body(List<@Valid User> body) {
reqSpec.setBody(body);
return this;
}

View File

@ -44,7 +44,7 @@ public class ArrayTest {
public static final String SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
@SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_OF_MODEL)
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
public ArrayTest() {
}
@ -112,13 +112,13 @@ public class ArrayTest {
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<>();
}
@ -134,12 +134,12 @@ public class ArrayTest {
@Valid
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -40,7 +40,7 @@ public class FileSchemaTestClass {
public static final String SERIALIZED_NAME_FILES = "files";
@SerializedName(SERIALIZED_NAME_FILES)
private List<ModelFile> files;
private List<@Valid ModelFile> files;
public FileSchemaTestClass() {
}
@ -69,7 +69,7 @@ public class FileSchemaTestClass {
}
public FileSchemaTestClass files(List<ModelFile> files) {
public FileSchemaTestClass files(List<@Valid ModelFile> files) {
this.files = files;
return this;
@ -91,12 +91,12 @@ public class FileSchemaTestClass {
@Valid
public List<ModelFile> getFiles() {
public List<@Valid ModelFile> getFiles() {
return files;
}
public void setFiles(List<ModelFile> files) {
public void setFiles(List<@Valid ModelFile> files) {
this.files = files;
}

View File

@ -55,7 +55,7 @@ public class Pet {
public static final String SERIALIZED_NAME_TAGS = "tags";
@SerializedName(SERIALIZED_NAME_TAGS)
private List<Tag> tags;
private List<@Valid Tag> tags;
/**
* pet status in the store
@ -216,7 +216,7 @@ public class Pet {
}
public Pet tags(List<Tag> tags) {
public Pet tags(List<@Valid Tag> tags) {
this.tags = tags;
return this;
@ -238,12 +238,12 @@ public class Pet {
@Valid
public List<Tag> getTags() {
public List<@Valid Tag> getTags() {
return tags;
}
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}

View File

@ -9,7 +9,7 @@
|------------ | ------------- | ------------- | -------------|
|**arrayOfString** | **List&lt;String&gt;** | | [optional] |
|**arrayArrayOfInteger** | **List&lt;List&lt;Long&gt;&gt;** | | [optional] |
|**arrayArrayOfModel** | **List&lt;List&lt;ReadOnlyFirst&gt;&gt;** | | [optional] |
|**arrayArrayOfModel** | **List&lt;List&lt;@Valid ReadOnlyFirst&gt;&gt;** | | [optional] |

View File

@ -102,7 +102,7 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
UserApi apiInstance = new UserApi(defaultClient);
List<User> body = Arrays.asList(); // List<User> | List of user object
List<@Valid User> body = Arrays.asList(); // List<@Valid User> | List of user object
try {
apiInstance.createUsersWithArrayInput(body);
} catch (ApiException e) {
@ -121,7 +121,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
### Return type
@ -165,7 +165,7 @@ public class Example {
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
UserApi apiInstance = new UserApi(defaultClient);
List<User> body = Arrays.asList(); // List<User> | List of user object
List<@Valid User> body = Arrays.asList(); // List<@Valid User> | List of user object
try {
apiInstance.createUsersWithListInput(body);
} catch (ApiException e) {
@ -184,7 +184,7 @@ public class Example {
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **body** | [**List&lt;User&gt;**](User.md)| List of user object | |
| **body** | [**List&lt;@Valid User&gt;**](User.md)| List of user object | |
### Return type

View File

@ -12,6 +12,9 @@ import okhttp3.MultipartBody;
import org.openapitools.client.model.Client;
import java.util.UUID;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -19,6 +19,9 @@ import org.openapitools.client.model.OuterComposite;
import org.openapitools.client.model.User;
import org.openapitools.client.model.XmlItem;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -11,6 +11,9 @@ import okhttp3.MultipartBody;
import org.openapitools.client.model.Client;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -14,6 +14,9 @@ import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import java.util.Set;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -11,6 +11,9 @@ import okhttp3.MultipartBody;
import org.openapitools.client.model.Order;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

View File

@ -12,6 +12,9 @@ import okhttp3.MultipartBody;
import java.time.OffsetDateTime;
import org.openapitools.client.model.User;
import javax.validation.constraints.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -40,7 +43,7 @@ public interface UserApi {
*/
@POST("user/createWithArray")
CompletionStage<Response<Void>> createUsersWithArrayInput(
@retrofit2.http.Body List<User> body
@retrofit2.http.Body List<@Valid User> body
);
/**
@ -51,7 +54,7 @@ public interface UserApi {
*/
@POST("user/createWithList")
CompletionStage<Response<Void>> createUsersWithListInput(
@retrofit2.http.Body List<User> body
@retrofit2.http.Body List<@Valid User> body
);
/**

View File

@ -46,7 +46,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger;
public static final String JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL = "array_array_of_model";
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
public ArrayTest() {
}
@ -122,13 +122,13 @@ public class ArrayTest {
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<>();
}
@ -146,14 +146,14 @@ public class ArrayTest {
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
@JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -42,7 +42,7 @@ public class FileSchemaTestClass {
private ModelFile _file;
public static final String JSON_PROPERTY_FILES = "files";
private List<ModelFile> files;
private List<@Valid ModelFile> files;
public FileSchemaTestClass() {
}
@ -75,7 +75,7 @@ public class FileSchemaTestClass {
}
public FileSchemaTestClass files(List<ModelFile> files) {
public FileSchemaTestClass files(List<@Valid ModelFile> files) {
this.files = files;
return this;
@ -99,14 +99,14 @@ public class FileSchemaTestClass {
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<ModelFile> getFiles() {
public List<@Valid ModelFile> getFiles() {
return files;
}
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setFiles(List<ModelFile> files) {
public void setFiles(List<@Valid ModelFile> files) {
this.files = files;
}

View File

@ -59,7 +59,7 @@ public class Pet {
private Set<String> photoUrls = new LinkedHashSet<>();
public static final String JSON_PROPERTY_TAGS = "tags";
private List<Tag> tags;
private List<@Valid Tag> tags;
/**
* pet status in the store
@ -224,7 +224,7 @@ public class Pet {
}
public Pet tags(List<Tag> tags) {
public Pet tags(List<@Valid Tag> tags) {
this.tags = tags;
return this;
@ -248,14 +248,14 @@ public class Pet {
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<Tag> getTags() {
public List<@Valid Tag> getTags() {
return tags;
}
@JsonProperty(JSON_PROPERTY_TAGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}

View File

@ -94,7 +94,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -124,7 +124,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -84,7 +84,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> user
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -114,7 +114,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> user
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -75,7 +75,7 @@ public interface UserController {
)
ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> body
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<@Valid User> body
);
@ -100,7 +100,7 @@ public interface UserController {
)
ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> body
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<@Valid User> body
);

View File

@ -84,7 +84,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> user
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -114,7 +114,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<User> user
@ApiParam(value = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -58,7 +58,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Valid @RequestBody List<User> user
@Valid @RequestBody List<@Valid User> user
);
@ -76,7 +76,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Valid @RequestBody List<User> user
@Valid @RequestBody List<@Valid User> user
);

View File

@ -94,7 +94,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -124,7 +124,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -95,7 +95,7 @@ public interface UserApi {
)
CompletableFuture<ResponseEntity<Void>> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -125,7 +125,7 @@ public interface UserApi {
)
CompletableFuture<ResponseEntity<Void>> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -88,7 +88,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -115,7 +115,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -32,7 +32,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger;
@Valid
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
@ -90,7 +90,7 @@ public class ArrayTest {
this.arrayArrayOfInteger = arrayArrayOfInteger;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
@ -110,11 +110,11 @@ public class ArrayTest {
@Valid
@Schema(name = "array_array_of_model", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("array_array_of_model")
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -84,7 +84,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "body", description = "List of user object", required = true) @Valid @RequestBody List<User> body
@Parameter(name = "body", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> body
);
@ -108,7 +108,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "body", description = "List of user object", required = true) @Valid @RequestBody List<User> body
@Parameter(name = "body", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> body
);

View File

@ -94,7 +94,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);
@ -124,7 +124,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
);

View File

@ -94,7 +94,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) throws Exception;
@ -124,7 +124,7 @@ public interface UserApi {
)
ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) throws Exception;

View File

@ -101,7 +101,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -134,7 +134,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@ -101,7 +101,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -134,7 +134,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@ -101,7 +101,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -134,7 +134,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@ -90,7 +90,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return getDelegate().createUsersWithArrayInput(user);
}
@ -119,7 +119,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return getDelegate().createUsersWithListInput(user);
}

View File

@ -47,7 +47,7 @@ public interface UserApiDelegate {
* @return successful operation (status code 200)
* @see UserApi#createUsersWithArrayInput
*/
default ResponseEntity<Void> createUsersWithArrayInput(List<User> user) {
default ResponseEntity<Void> createUsersWithArrayInput(List<@Valid User> user) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
@ -60,7 +60,7 @@ public interface UserApiDelegate {
* @return successful operation (status code 200)
* @see UserApi#createUsersWithListInput
*/
default ResponseEntity<Void> createUsersWithListInput(List<User> user) {
default ResponseEntity<Void> createUsersWithListInput(List<@Valid User> user) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

View File

@ -32,7 +32,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger;
@Valid
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
@ -90,7 +90,7 @@ public class ArrayTest {
this.arrayArrayOfInteger = arrayArrayOfInteger;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
@ -110,11 +110,11 @@ public class ArrayTest {
@Valid
@Schema(name = "array_array_of_model", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("array_array_of_model")
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -95,7 +95,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -125,7 +125,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@ -32,7 +32,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger;
@Valid
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString;
@ -90,7 +90,7 @@ public class ArrayTest {
this.arrayArrayOfInteger = arrayArrayOfInteger;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
@ -110,11 +110,11 @@ public class ArrayTest {
@Valid
@Schema(name = "array_array_of_model", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("array_array_of_model")
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

View File

@ -65,7 +65,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Valid @RequestBody List<User> user
@Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -86,7 +86,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Valid @RequestBody List<User> user
@Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@ -102,7 +102,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithArrayInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@ -135,7 +135,7 @@ public interface UserApi {
)
default ResponseEntity<Void> createUsersWithListInput(
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<User> user
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);

View File

@ -113,7 +113,7 @@ public interface FakeService {
@GET
@Consumes({ "application/x-www-form-urlencoded" })
void testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") @DefaultValue("-efg") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @QueryParam("enum_query_model_array") List<EnumClass> enumQueryModelArray, @FormParam(value = "enum_form_string_array") List<String> enumFormStringArray, @FormParam(value = "enum_form_string") String enumFormString);
void testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray, @HeaderParam("enum_header_string") @DefaultValue("-efg") String enumHeaderString, @QueryParam("enum_query_string_array") List<String> enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @QueryParam("enum_query_model_array") List<@Valid EnumClass> enumQueryModelArray, @FormParam(value = "enum_form_string_array") List<String> enumFormStringArray, @FormParam(value = "enum_form_string") String enumFormString);
@DELETE
void testGroupParameters(@QueryParam("required_string_group") @NotNull Integer requiredStringGroup, @HeaderParam("required_boolean_group") @NotNull Boolean requiredBooleanGroup, @QueryParam("required_int64_group") @NotNull Long requiredInt64Group, @QueryParam("string_group") Integer stringGroup, @HeaderParam("boolean_group") Boolean booleanGroup, @QueryParam("int64_group") Long int64Group);

View File

@ -143,7 +143,7 @@ public class FakeServiceImpl implements FakeService {
@GET
@Consumes({ "application/x-www-form-urlencoded" })
public void testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") String enumHeaderString,@QueryParam("enum_query_string_array") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString,@QueryParam("enum_query_integer") Integer enumQueryInteger,@QueryParam("enum_query_double") Double enumQueryDouble,@QueryParam("enum_query_model_array") List<EnumClass> enumQueryModelArray,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) {
public void testEnumParameters(@HeaderParam("enum_header_string_array") List<String> enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") String enumHeaderString,@QueryParam("enum_query_string_array") List<String> enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString,@QueryParam("enum_query_integer") Integer enumQueryInteger,@QueryParam("enum_query_double") Double enumQueryDouble,@QueryParam("enum_query_model_array") List<@Valid EnumClass> enumQueryModelArray,@FormParam(value = "enum_form_string_array") List<String> enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) {
}
@DELETE

View File

@ -35,12 +35,12 @@ public interface UserService {
@POST
@Path("/createWithArray")
@Consumes({ "application/json" })
void createUsersWithArrayInput(@Valid @NotNull List<User> user);
void createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user);
@POST
@Path("/createWithList")
@Consumes({ "application/json" })
void createUsersWithListInput(@Valid @NotNull List<User> user);
void createUsersWithListInput(@Valid @NotNull List<@Valid User> user);
@DELETE
@Path("/{username}")

View File

@ -37,13 +37,13 @@ public class UserServiceImpl implements UserService {
@POST
@Path("/createWithArray")
@Consumes({ "application/json" })
public void createUsersWithArrayInput(@Valid @NotNull List<User> user) {
public void createUsersWithArrayInput(@Valid @NotNull List<@Valid User> user) {
}
@POST
@Path("/createWithList")
@Consumes({ "application/json" })
public void createUsersWithListInput(@Valid @NotNull List<User> user) {
public void createUsersWithListInput(@Valid @NotNull List<@Valid User> user) {
}
@DELETE

View File

@ -31,7 +31,7 @@ public class ArrayTest {
private List<List<Long>> arrayArrayOfInteger = null;
private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel = null;
/**
* Get arrayOfString
@ -87,23 +87,23 @@ public class ArrayTest {
* Get arrayArrayOfModel
* @return arrayArrayOfModel
**/
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
/**
* Set arrayArrayOfModel
**/
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}
public ArrayTest arrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public ArrayTest arrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
return this;
}
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
public ArrayTest addArrayArrayOfModelItem(List<@Valid ReadOnlyFirst> arrayArrayOfModelItem) {
this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this;
}

View File

@ -29,7 +29,7 @@ public class FileSchemaTestClass {
private ModelFile _file;
private List<ModelFile> files = null;
private List<@Valid ModelFile> files = null;
/**
* Get _file
@ -55,18 +55,18 @@ public class FileSchemaTestClass {
* Get files
* @return files
**/
public List<ModelFile> getFiles() {
public List<@Valid ModelFile> getFiles() {
return files;
}
/**
* Set files
**/
public void setFiles(List<ModelFile> files) {
public void setFiles(List<@Valid ModelFile> files) {
this.files = files;
}
public FileSchemaTestClass files(List<ModelFile> files) {
public FileSchemaTestClass files(List<@Valid ModelFile> files) {
this.files = files;
return this;
}

View File

@ -34,7 +34,7 @@ public class ObjectWithDeprecatedFields {
private DeprecatedObject deprecatedRef;
private List<String> bars = null;
private List<@Valid String> bars = null;
/**
* Get uuid
@ -106,18 +106,18 @@ public class ObjectWithDeprecatedFields {
* @deprecated
**/
@Deprecated
public List<String> getBars() {
public List<@Valid String> getBars() {
return bars;
}
/**
* Set bars
**/
public void setBars(List<String> bars) {
public void setBars(List<@Valid String> bars) {
this.bars = bars;
}
public ObjectWithDeprecatedFields bars(List<String> bars) {
public ObjectWithDeprecatedFields bars(List<@Valid String> bars) {
this.bars = bars;
return this;
}

View File

@ -41,7 +41,7 @@ public class Pet {
private Set<String> photoUrls = new LinkedHashSet<>();
private List<Tag> tags = null;
private List<@Valid Tag> tags = null;
public enum StatusEnum {
@ -187,18 +187,18 @@ public enum StatusEnum {
* Get tags
* @return tags
**/
public List<Tag> getTags() {
public List<@Valid Tag> getTags() {
return tags;
}
/**
* Set tags
**/
public void setTags(List<Tag> tags) {
public void setTags(List<@Valid Tag> tags) {
this.tags = tags;
}
public Pet tags(List<Tag> tags) {
public Pet tags(List<@Valid Tag> tags) {
this.tags = tags;
return this;
}

View File

@ -2,6 +2,8 @@ package org.openapitools.server.model;
import java.util.HashMap;
import java.util.Map;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;

View File

@ -3,6 +3,8 @@ package org.openapitools.server.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import org.openapitools.server.model.SingleRefType;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;

View File

@ -3,6 +3,8 @@ package org.openapitools.server.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;

View File

@ -4,6 +4,8 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;

View File

@ -4,6 +4,8 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.openapitools.server.model.ReadOnlyFirst;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
@ -11,7 +13,7 @@ public class ArrayTest {
private List<String> arrayOfString;
private List<List<Long>> arrayArrayOfInteger;
private List<List<ReadOnlyFirst>> arrayArrayOfModel;
private List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel;
/**
* Default constructor.
@ -30,7 +32,7 @@ public class ArrayTest {
public ArrayTest(
List<String> arrayOfString,
List<List<Long>> arrayArrayOfInteger,
List<List<ReadOnlyFirst>> arrayArrayOfModel
List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel
) {
this.arrayOfString = arrayOfString;
this.arrayArrayOfInteger = arrayArrayOfInteger;
@ -67,11 +69,11 @@ public class ArrayTest {
* Get arrayArrayOfModel
* @return arrayArrayOfModel
*/
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
public List<List<@Valid ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
}
public void setArrayArrayOfModel(List<List<ReadOnlyFirst>> arrayArrayOfModel) {
public void setArrayArrayOfModel(List<List<@Valid ReadOnlyFirst>> arrayArrayOfModel) {
this.arrayArrayOfModel = arrayArrayOfModel;
}

Some files were not shown because too many files have changed in this diff Show More