mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 00:17:05 +00:00
[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:
@@ -9,7 +9,7 @@
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**arrayOfString** | **List<String>** | | [optional] |
|
||||
|**arrayArrayOfInteger** | **List<List<Long>>** | | [optional] |
|
||||
|**arrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] |
|
||||
|**arrayArrayOfModel** | **List<List<@Valid ReadOnlyFirst>>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ api.createUsersWithArrayInput()
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **body** | [**List<User>**](User.md)| List of user object | |
|
||||
| **body** | [**List<@Valid User>**](User.md)| List of user object | |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -121,7 +121,7 @@ api.createUsersWithListInput()
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **body** | [**List<User>**](User.md)| List of user object | |
|
||||
| **body** | [**List<@Valid User>**](User.md)| List of user object | |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<User>) List of user object (required)
|
||||
* @param body (List<@Valid User>) 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<User>) List of user object (required)
|
||||
* @param body (List<@Valid User>) 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user