diff --git a/boat-maven-plugin/src/it/example/boat-generate/java-server/models/pom.xml b/boat-maven-plugin/src/it/example/boat-generate/java-server/models/pom.xml
index d642577db..3b14a7f7e 100644
--- a/boat-maven-plugin/src/it/example/boat-generate/java-server/models/pom.xml
+++ b/boat-maven-plugin/src/it/example/boat-generate/java-server/models/pom.xml
@@ -73,6 +73,11 @@
swagger-annotations
2.2.7
+
+
+ org.springframework
+ spring-core
+
jar
diff --git a/boat-maven-plugin/src/it/example/pom.xml b/boat-maven-plugin/src/it/example/pom.xml
index 650561ff3..9bd39dd2a 100644
--- a/boat-maven-plugin/src/it/example/pom.xml
+++ b/boat-maven-plugin/src/it/example/pom.xml
@@ -11,7 +11,6 @@
@pom.version@
-
0.2.3
2.13.3
diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java
index 233cdabe1..4ea7d3d85 100644
--- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java
+++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java
@@ -1,28 +1,5 @@
package com.backbase.oss.boat;
-import static java.lang.String.format;
-import static java.util.Arrays.stream;
-import static java.util.Collections.emptyMap;
-import static java.util.stream.Collectors.joining;
-import static org.apache.commons.lang3.StringUtils.isNotEmpty;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyAdditionalPropertiesKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyAdditionalPropertiesKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyImportMappingsKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyImportMappingsKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyInstantiationTypesKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsvList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyOpenAPINormalizerKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyReservedWordsMappingsKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applySchemaMappingsKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applySchemaMappingsKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyServerVariablesKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyServerVariablesKvpList;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvp;
-import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyTypeMappingsKvpList;
-
import com.backbase.oss.boat.transformers.Bundler;
import com.backbase.oss.boat.transformers.DereferenceComponentsPropertiesTransformer;
import com.backbase.oss.boat.transformers.UnAliasTransformer;
@@ -33,31 +10,6 @@
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.parser.core.models.AuthorizationValue;
import io.swagger.v3.parser.util.ClasspathHelper;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.channels.Channels;
-import java.nio.channels.FileChannel;
-import java.nio.channels.ReadableByteChannel;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.StandardCopyOption;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
@@ -66,17 +18,36 @@
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
-import org.openapitools.codegen.CliOption;
-import org.openapitools.codegen.ClientOptInput;
-import org.openapitools.codegen.CodegenConfig;
-import org.openapitools.codegen.CodegenConstants;
-import org.openapitools.codegen.DefaultGenerator;
+import org.openapitools.codegen.*;
import org.openapitools.codegen.auth.AuthParser;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.openapitools.codegen.config.GlobalSettings;
+import org.openapitools.codegen.utils.OptionUtils;
import org.sonatype.plexus.build.incremental.BuildContext;
import org.sonatype.plexus.build.incremental.DefaultBuildContext;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.*;
+import java.nio.channels.Channels;
+import java.nio.channels.FileChannel;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.StandardCopyOption;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static java.lang.String.format;
+import static java.util.Arrays.stream;
+import static java.util.Collections.emptyMap;
+import static java.util.stream.Collectors.joining;
+import static org.apache.commons.lang3.StringUtils.isNotEmpty;
+import static org.openapitools.codegen.config.CodegenConfiguratorUtils.*;
+
/**
* Generates client/server code from an OpenAPI json/yaml definition.
*/
@@ -573,13 +544,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
java.nio.file.Files.copy(inputSpecFile.toPath(), copyTo.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
- // attempt to read from config file
- CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
-
- // if a config file wasn't specified or we were unable to read it
- if (configurator == null) {
- configurator = new CodegenConfigurator();
- }
+ final CodegenConfigurator configurator = loadCodegenConfigurator();
configurator.setVerbose(verbose);
@@ -857,7 +822,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
if (openapiNormalizer != null && (configOptions == null || !configOptions.containsKey("openapi-normalizer"))) {
- applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);
+ for (String propString: openapiNormalizer) {
+ OptionUtils.parseCommaSeparatedTuples(propString)
+ .forEach(p -> configurator.addOpenapiNormalizer(p.getLeft(), p.getRight()));
+ }
}
// Apply Schema Mappings
@@ -953,6 +921,16 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}
+ /**
+ * Attempt to read from config file, return default otherwise.
+ *
+ * @return The CodegenConfigurator loaded from file or a default.
+ */
+ private CodegenConfigurator loadCodegenConfigurator() {
+ CodegenConfigurator configurator = CodegenConfigurator.fromFile(configurationFile);
+ return configurator != null ? configurator : new CodegenConfigurator();
+ }
+
protected Collection getGeneratorSpecificSupportingFiles() {
return Collections.emptySet();
}
diff --git a/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatJavaCodeGen.java b/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatJavaCodeGen.java
index b1fc08324..2d8750007 100644
--- a/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatJavaCodeGen.java
+++ b/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatJavaCodeGen.java
@@ -1,7 +1,6 @@
package com.backbase.oss.codegen.java;
import com.backbase.oss.codegen.java.BoatCodeGenUtils.CodegenValueType;
-import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter;
import lombok.Setter;
@@ -157,7 +156,7 @@ private boolean isArrayTypeOfEnum(Schema s) {
if (!ModelUtils.isArraySchema(target)) {
return false;
}
- Schema items = getSchemaItems((ArraySchema) target);
+ Schema items = target.getItems();
if (items.get$ref() != null) {
items = openAPI.getComponents().getSchemas().get(ModelUtils.getSimpleRef(items.get$ref()));
}
diff --git a/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodeGen.java b/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodeGen.java
index 89e23ee2e..f67fa1f54 100644
--- a/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodeGen.java
+++ b/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodeGen.java
@@ -414,7 +414,6 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert
if (shouldSerializeBigDecimalAsString(property)) {
property.vendorExtensions.put("x-extra-annotation", "@JsonSerialize(using = BigDecimalCustomSerializer.class)");
model.imports.add("BigDecimalCustomSerializer");
- model.imports.add("JsonSerialize");
}
}
diff --git a/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodegenProperty.java b/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodegenProperty.java
index 60f0a750c..7f6239fbf 100644
--- a/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodegenProperty.java
+++ b/boat-scaffold/src/main/java/com/backbase/oss/codegen/java/BoatSpringCodegenProperty.java
@@ -137,6 +137,7 @@ public BoatSpringCodegenProperty(CodegenProperty codegenProperty) {
defaultValue = "new HashMap<>()";
isMap = true;
}
+ this.nameInCamelCase = StringUtils.capitalize(this.nameInCamelCase);
}
@Override
public String toString() {
diff --git a/boat-scaffold/src/main/templates/boat-java/libraries/apache-httpclient/BaseApi.mustache b/boat-scaffold/src/main/templates/boat-java/libraries/apache-httpclient/BaseApi.mustache
new file mode 100644
index 000000000..8b48de086
--- /dev/null
+++ b/boat-scaffold/src/main/templates/boat-java/libraries/apache-httpclient/BaseApi.mustache
@@ -0,0 +1,110 @@
+{{>licenseInfo}}
+package {{invokerPackage}};
+
+import com.fasterxml.jackson.core.type.TypeReference;
+
+import java.util.Collections;
+import java.util.Map;
+
+{{>generatedAnnotation}}
+public abstract class BaseApi {
+
+ protected ApiClient apiClient;
+
+ public BaseApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public BaseApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @throws ApiException if fails to make API call.
+ */
+ public void invokeAPI(String url, String method) throws ApiException {
+ invokeAPI(url, method, null, null, Collections.emptyMap());
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param additionalHeaders Additional headers for the request.
+ * @throws ApiException if fails to make API call.
+ */
+ public void invokeAPI(String url, String method, Map additionalHeaders) throws ApiException {
+ invokeAPI(url, method, null, null, additionalHeaders);
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param request The request object.
+ * @throws ApiException if fails to make API call.
+ */
+ public void invokeAPI(String url, String method, Object request) throws ApiException {
+ invokeAPI(url, method, request, null, Collections.emptyMap());
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param request The request object.
+ * @param additionalHeaders Additional headers for the request.
+ * @throws ApiException if fails to make API call.
+ */
+ public void invokeAPI(String url, String method, Object request, Map additionalHeaders) throws ApiException {
+ invokeAPI(url, method, request, null, additionalHeaders);
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param returnType The return type.
+ * @return The API response in the specified type.
+ * @throws ApiException if fails to make API call.
+ */
+ public T invokeAPI(String url, String method, TypeReference returnType) throws ApiException {
+ return invokeAPI(url, method, null, returnType, Collections.emptyMap());
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param request The request object.
+ * @param returnType The return type.
+ * @return The API response in the specified type.
+ * @throws ApiException if fails to make API call.
+ */
+ public T invokeAPI(String url, String method, Object request, TypeReference returnType) throws ApiException {
+ return invokeAPI(url, method, request, returnType, Collections.emptyMap());
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param request The request object.
+ * @param returnType The return type.
+ * @param additionalHeaders Additional headers for the request.
+ * @return The API response in the specified type.
+ * @throws ApiException if fails to make API call.
+ */
+ public abstract T invokeAPI(String url, String method, Object request, TypeReference returnType, Map additionalHeaders) throws ApiException;
+}
diff --git a/boat-scaffold/src/main/templates/boat-java/libraries/resttemplate/BaseApi.mustache b/boat-scaffold/src/main/templates/boat-java/libraries/resttemplate/BaseApi.mustache
new file mode 100644
index 000000000..3b47979ed
--- /dev/null
+++ b/boat-scaffold/src/main/templates/boat-java/libraries/resttemplate/BaseApi.mustache
@@ -0,0 +1,76 @@
+{{>licenseInfo}}
+
+package {{invokerPackage}};
+
+import org.springframework.web.client.RestClientException;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+{{>generatedAnnotation}}
+public abstract class BaseApi {
+
+ protected ApiClient apiClient;
+
+ public BaseApi() {
+ this(new ApiClient());
+ }
+
+ public BaseApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @return ResponseEntity<Void>
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public ResponseEntity invokeAPI(String url, HttpMethod method) throws RestClientException {
+ return invokeAPI(url, method, null, new ParameterizedTypeReference() {});
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param request The request object.
+ * @return ResponseEntity<Void>
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public ResponseEntity invokeAPI(String url, HttpMethod method, Object request) throws RestClientException {
+ return invokeAPI(url, method, request, new ParameterizedTypeReference() {});
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param returnType The return type.
+ * @return ResponseEntity in the specified type.
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public ResponseEntity invokeAPI(String url, HttpMethod method, ParameterizedTypeReference returnType) throws RestClientException {
+ return invokeAPI(url, method, null, returnType);
+ }
+
+ /**
+ * Directly invoke the API for the given URL. Useful if the API returns direct links/URLs for subsequent requests.
+ * @param url The URL for the request, either full URL or only the path.
+ * @param method The HTTP method for the request.
+ * @param request The request object.
+ * @param returnType The return type.
+ * @return ResponseEntity in the specified type.
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public abstract ResponseEntity invokeAPI(String url, HttpMethod method, Object request, ParameterizedTypeReference returnType) throws RestClientException;
+}
diff --git a/boat-scaffold/src/main/templates/boat-java/model.mustache b/boat-scaffold/src/main/templates/boat-java/model.mustache
index 140d35fc3..06c6ff72f 100644
--- a/boat-scaffold/src/main/templates/boat-java/model.mustache
+++ b/boat-scaffold/src/main/templates/boat-java/model.mustache
@@ -17,6 +17,7 @@ import java.io.Serializable;
{{#jackson}}
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonTypeName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.*;
{{/withXml}}
diff --git a/boat-scaffold/src/main/templates/boat-spring/model.mustache b/boat-scaffold/src/main/templates/boat-spring/model.mustache
index 896d93104..5cc67ab79 100644
--- a/boat-scaffold/src/main/templates/boat-spring/model.mustache
+++ b/boat-scaffold/src/main/templates/boat-spring/model.mustache
@@ -45,6 +45,7 @@ import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
{{/performBeanValidation}}
{{#jackson}}
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
{{#withXml}}
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
diff --git a/boat-scaffold/src/test/java/com/backbase/oss/codegen/java/BoatJavaCodeGenTests.java b/boat-scaffold/src/test/java/com/backbase/oss/codegen/java/BoatJavaCodeGenTests.java
index 1dd8c6215..fbc8d3b70 100644
--- a/boat-scaffold/src/test/java/com/backbase/oss/codegen/java/BoatJavaCodeGenTests.java
+++ b/boat-scaffold/src/test/java/com/backbase/oss/codegen/java/BoatJavaCodeGenTests.java
@@ -1,36 +1,34 @@
package com.backbase.oss.codegen.java;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.CREATE_API_COMPONENT;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.REST_TEMPLATE_BEAN_NAME;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.USE_CLASS_LEVEL_BEAN_VALIDATION;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.USE_DEFAULT_API_CLIENT;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.USE_JACKSON_CONVERSION;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.USE_PROTECTED_FIELDS;
-import static com.backbase.oss.codegen.java.BoatJavaCodeGen.USE_WITH_MODIFIERS;
-import static java.util.stream.Collectors.groupingBy;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasEntry;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.TypeDeclaration;
import io.swagger.parser.OpenAPIParser;
+import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.parser.core.models.ParseOptions;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.DefaultGenerator;
+import org.openapitools.codegen.config.GlobalSettings;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+import static com.backbase.oss.codegen.java.BoatJavaCodeGen.*;
+import static java.util.stream.Collectors.groupingBy;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
class BoatJavaCodeGenTests {
@@ -208,4 +206,40 @@ void shouldHonourBeanValidationOption(boolean useBeanValidation) throws FileNotF
assertThat("Expect jakarta Valid import", compilationUnit.getImports().stream().anyMatch(
id -> id.getNameAsString().equals("jakarta.validation.Valid")), is(useBeanValidation));
}
+
+ @ParameterizedTest
+ @MethodSource("testTypeDeclarationValues")
+ public void testTypeDeclaration(boolean useBeanValidation, String schemaType,
+ String itemType, boolean itemEnum, String expected) {
+
+ // Setup
+ BoatJavaCodeGen gen = new BoatJavaCodeGen();
+ gen.setUseBeanValidation(useBeanValidation);
+ GlobalSettings.setProperty("generateAliasAsModel", "true");
+
+ Schema schema = new Schema();
+ schema.type(schemaType);
+ if (itemType != null) {
+ Schema itemSchema = new Schema();
+ itemSchema.type(itemType);
+ if (itemEnum) {
+ itemSchema.setEnum(List.of("1", "2"));
+ }
+ schema.setItems(itemSchema);
+ }
+
+ String s = gen.getTypeDeclaration(schema);
+ assertEquals(expected, s);
+ }
+
+ static Stream testTypeDeclarationValues() {
+ return Stream.of(
+ Arguments.of(true, "string", null, false, "String"),
+ Arguments.of(false, "string", null, false, "String"),
+ Arguments.of(true, "array", "string", false, "List"),
+ Arguments.of(true, "array", "string", true, "List<@Valid String>"),
+ Arguments.of(true, "array", "object", false, "List