Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ It currently consists of
# Release Notes
BOAT is still under development and subject to change.

## 0.18.0
* openapi-generator `7.20.0` baseline (Spring Boot 4, Jackson 3)
* moved Java and JavaSpring templates to `7.20.0` adding remaing custom features
* removed custom `createApiComponent` in favor of the standard `generateClientAsBean` with default set to `true`
* removed custom `useLombokAnnotations` in favor of built-in `lombokAnnotation` template
* removed custom `useClassLevelBeanValidation` in favor of the standard `useSpringBuiltInValidation` property
* removed custom `useWithModifiers`, fluent setters already included in generated classes (property name methods)
* removed unused `useProtectedFields` property
* removed unused `useDefaultApiClient` property

## 0.17.75
* Fixed duplicate serialization of the discriminator property in Jackson-based Java models by removing allowGetters = true from the @JsonIgnoreProperties annotation.
* In Spring generator added support for type-level validation in collections via the `x-not-null` vendor extension to allow `@NotNull` annotations on generic type arguments.
Expand Down Expand Up @@ -725,7 +735,6 @@ For the `spring` generator, the additional configuration options are:
| `useTags` | use tags for creating interface and controller classnames (Default: false) |
| `useBeanValidation` | Use BeanValidation API annotations (Default: true) |
| `performBeanValidation` | Use Bean Validation Impl. to perform BeanValidation (Default: false) |
| `useClassLevelBeanValidation` | Adds @Validated annotation to API interfaces (Default: false) |
| `useLombokAnnotations` | Use Lombok annotations to generate properties accessors and `hashCode`/`equals` methods (Default: false) |
| `addServletRequest` | Adds ServletRequest objects to API method definitions (Default: false) |
| `addBindingResult` | Adds BindingResult to Api method definitions' request bodies if UseBeanValidation true, for this to be effective you must configure UseBeanValidation, this is not done automatically (Default: false)|
Expand Down
2 changes: 1 addition & 1 deletion boat-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
</parent>
<artifactId>boat-engine</artifactId>
<packaging>jar</packaging>
Expand Down
6 changes: 1 addition & 5 deletions boat-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Same with `generate` but with opinionated defaults for Spring
<interfaceOnly>true</interfaceOnly>
<skipDefaultInterface>true</skipDefaultInterface>
<useBeanValidation>true</useBeanValidation>
<useClassLevelBeanValidation>false</useClassLevelBeanValidation>
<useTags>true</useTags>
<java8>true</java8>
<useOptional>false</useOptional>
Expand Down Expand Up @@ -78,7 +77,6 @@ It will generate webhook interfaces with prehook and posthook request mapping fo
<interfaceOnly>true</interfaceOnly>
<skipDefaultInterface>true</skipDefaultInterface>
<useBeanValidation>true</useBeanValidation>
<useClassLevelBeanValidation>false</useClassLevelBeanValidation>
<useTags>true</useTags>
<java8>true</java8>
<useOptional>false</useOptional>
Expand Down Expand Up @@ -108,7 +106,6 @@ Same with `generate` but with opinionated defaults for Rest Template Client
<interfaceOnly>true</interfaceOnly>
<skipDefaultInterface>true</skipDefaultInterface>
<useBeanValidation>true</useBeanValidation>
<useClassLevelBeanValidation>false</useClassLevelBeanValidation>
<useTags>true</useTags>
<java8>true</java8>
<useOptional>false</useOptional>
Expand All @@ -122,7 +119,7 @@ Same with `generate` but with opinionated defaults for Rest Template Client
<configuration>
...
<additionalProperties>
<additionalProperty>createApiComponent=false</additionalProperty>
<additionalProperty>restTemplateBeanName=interServiceRestTemplate</additionalProperty>
</additionalProperties>
</configuration>

Expand Down Expand Up @@ -198,7 +195,6 @@ Same with `generate` but with opinionated defaults for Web Client
<interfaceOnly>true</interfaceOnly>
<skipDefaultInterface>true</skipDefaultInterface>
<useBeanValidation>true</useBeanValidation>
<useClassLevelBeanValidation>false</useClassLevelBeanValidation>
<useTags>true</useTags>
<java8>true</java8>
<useOptional>false</useOptional>
Expand Down
16 changes: 14 additions & 2 deletions boat-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
</parent>
<artifactId>boat-maven-plugin</artifactId>

Expand Down Expand Up @@ -53,6 +53,18 @@
<groupId>org.openapitools.openapidiff</groupId>
<artifactId>openapi-diff-core</artifactId>
<version>2.1.7</version>
<exclusions>
<!-- Avoid loading Apache HttpClient in plugin realm to prevent
ClassRealm conflicts with Maven's own transport stack. -->
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -360,7 +372,7 @@
<plugin>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-maven-plugin</artifactId>
<version>0.17.50</version>
<version>0.17.74</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<name>BOAT :: Generate :: Java Client</name>

<properties>
<boat-maven-plugin.supportingFilesToGenerate>ApiClient.java,BeanValidationException.java,RFC3339DateFormat.java,ServerConfiguration.java,ServerVariable.java,StringUtil.java,Authentication.java,HttpBasicAuth.java,HttpBearerAuth.java,ApiKeyAuth.java,ApiException.java,Pair.java,ApiResponse.java,JavaTimeFormatter.java</boat-maven-plugin.supportingFilesToGenerate>
<boat-maven-plugin.supportingFilesToGenerate>ApiClient.java,BeanValidationException.java,RFC3339DateFormat.java,ServerConfiguration.java,ServerVariable.java,StringUtil.java,Authentication.java,HttpBasicAuth.java,HttpBearerAuth.java,ApiKeyAuth.java,ApiException.java,Pair.java,ApiResponse.java,JavaTimeFormatter.java,RFC3339JavaTimeModule.java,Configuration.java,RFC3339InstantDeserializer.java,JSON.java,AbstractOpenApiSchema.java</boat-maven-plugin.supportingFilesToGenerate>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
<artifactId>swagger-annotations</artifactId>
<version>2.2.7</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
</dependencies>

<packaging>jar</packaging>
Expand Down
12 changes: 6 additions & 6 deletions boat-maven-plugin/src/it/example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<properties>

<boat-maven-plugin.version>@pom.version@</boat-maven-plugin.version>
<!-- <boat-maven-plugin.version>0.12.0-SNAPS§HOT</boat-maven-plugin.version>-->
<jackson-databind-nullable-version>0.2.3</jackson-databind-nullable-version>
<!-- <boat-maven-plugin.version>0.12.0-SNAPS§HOT</boat-maven-plugin.version>-->
<jackson-databind-nullable-version>0.2.9</jackson-databind-nullable-version>

<jackson.version>2.13.3</jackson.version>
<jackson.version>2.18.2</jackson.version>
<jackson.version.annotations>${jackson.version}</jackson.version.annotations>
<jackson.version.core>${jackson.version}</jackson.version.core>
<jackson.version.databind>${jackson.version}</jackson.version.databind>
Expand Down Expand Up @@ -135,7 +135,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.7.2</version>
<version>3.3.13</version>
</dependency>

<dependency>
Expand All @@ -147,13 +147,13 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.7.2</version>
<version>3.3.13</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.1.14</version>
<version>6.1.21</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.codegen.languages.SpringCodegen;

@Slf4j
public abstract class AbstractGenerateMojo extends GenerateMojo {
Expand All @@ -33,7 +34,6 @@ public void execute(String generatorName, String library, boolean isEmbedded, bo
options.put("interfaceOnly", TRUE);
options.put("useTags", TRUE);
options.put("useBeanValidation", TRUE);
options.put("useClassLevelBeanValidation", FALSE);
options.put("useOptional", FALSE);
options.put("useJakartaEe", TRUE);
options.put("useSpringBoot3", TRUE);
Expand Down Expand Up @@ -64,7 +64,21 @@ public void execute(String generatorName, String library, boolean isEmbedded, bo
var merged = new HashMap<>();
merged.putAll(defaultOptions);
merged.putAll(overrides);
boolean sb3 = propertyToBool(merged.get(SpringCodegen.USE_SPRING_BOOT3));
boolean sb4 = propertyToBool(merged.get(SpringCodegen.USE_SPRING_BOOT4));
if (sb3 && sb4) {
merged.put(SpringCodegen.USE_SPRING_BOOT3, FALSE);
}
return merged;
}

private static boolean propertyToBool(Object value) {
if (value instanceof Boolean) {
return (Boolean) value;
} else if (value instanceof String) {
return Boolean.parseBoolean((String) value);
}
return false;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsv;
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyLanguageSpecificPrimitivesCsvList;
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyNameMappingsKvpList;
import static org.openapitools.codegen.config.CodegenConfiguratorUtils.applyOpenAPINormalizerKvpList;
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;
Expand Down Expand Up @@ -880,7 +880,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

if (openapiNormalizer != null && (configOptions == null || !configOptions.containsKey("openapi-normalizer"))) {
applyOpenAPINormalizerKvpList(openapiNormalizer, configurator);
applyOpenapiNormalizerKvpList(openapiNormalizer, configurator);
}

// Apply Schema Mappings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {

@Override
protected Collection<String> getGeneratorSpecificSupportingFiles() {
return Set.of("BigDecimalCustomSerializer.java");
return Set.of("BigDecimalCustomSerializer.java", "BaseApi.java");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException, MojoFai
);
assertThat(
mojo.getGeneratorSpecificSupportingFiles(),
containsInAnyOrder("BigDecimalCustomSerializer.java")
containsInAnyOrder("BigDecimalCustomSerializer.java", "BaseApi.java")
);
}

Expand Down Expand Up @@ -146,7 +146,6 @@ void shouldApplyDefaultConfigOptionsForSpringBoot() throws MojoExecutionExceptio
expectedOpts.put("interfaceOnly", "true");
expectedOpts.put("useTags", "true");
expectedOpts.put("useBeanValidation", "true");
expectedOpts.put("useClassLevelBeanValidation", "false");
expectedOpts.put("useOptional", "false");
expectedOpts.put("useJakartaEe", "true");
expectedOpts.put("useSpringBoot3", "true");
Expand Down Expand Up @@ -177,7 +176,6 @@ void shouldOverrideDefaultConfigOptionsForSpringBoot() throws MojoExecutionExcep
expectedOpts.put("interfaceOnly", "true");
expectedOpts.put("useTags", "true");
expectedOpts.put("useBeanValidation", "true");
expectedOpts.put("useClassLevelBeanValidation", "false");
expectedOpts.put("useOptional", "true");
expectedOpts.put("useJakartaEe", "true");
expectedOpts.put("useSpringBoot3", "true");
Expand All @@ -189,6 +187,36 @@ void shouldOverrideDefaultConfigOptionsForSpringBoot() throws MojoExecutionExcep
});
}

@Test
void shouldResolveSpringBootOptions() throws MojoExecutionException, MojoFailureException {
GenerateMojo mojo = configure(new GenerateSpringBootEmbeddedMojo(), null);
// add overrides
mojo.configOptions = Map.of(
"useSpringBoot4", "true"
);

mojo.execute();

Map<String, String> expectedOpts = new HashMap<>();
expectedOpts.put("java8", "true");
expectedOpts.put("dateLibrary", "java8");
expectedOpts.put("performBeanValidation", "true");
expectedOpts.put("skipDefaultInterface", "true");
expectedOpts.put("interfaceOnly", "true");
expectedOpts.put("useTags", "true");
expectedOpts.put("useBeanValidation", "true");
expectedOpts.put("useOptional", "false");
expectedOpts.put("useJakartaEe", "true");
expectedOpts.put("useSpringBoot3", "false");
expectedOpts.put("useSpringBoot4", "true");
expectedOpts.put("containerDefaultToNull", "false");

assertNotNull(mojo.configOptions);
expectedOpts.forEach((key, value) -> {
assertEquals(value, mojo.configOptions.get(key));
});
}

private <T extends GenerateMojo> T configure(T mojo, String generatorName) {
mojo.buildContext = buildContext;
mojo.project = project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,10 @@ private List<BoatLintReport> buildSampleBoatLintReports(String expectedDefaultKe
boatLintReport.setId(BigDecimal.TEN);
boatLintReport.setGrade(reportGrade);
boatLintReport.violations(
List.of(BoatViolation.builder().severity(sampleSeverityInResponse).build()));
List.of(new BoatViolation().severity(sampleSeverityInResponse)));
boatLintReport.setSpec(
BoatSpec.builder().key(expectedDefaultKey).description(description).changes(typeOfChange).build());
new BoatSpec().key(expectedDefaultKey).description(description).changes(typeOfChange));

return List.of(boatLintReport);
}

Expand Down
2 changes: 1 addition & 1 deletion boat-quay/boat-quay-lint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-quay</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
</parent>

<artifactId>boat-quay-lint</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/boat-quay-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-quay</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
</parent>

<artifactId>boat-quay-rules</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
</parent>


Expand Down
7 changes: 0 additions & 7 deletions boat-scaffold/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ The `boat` plugin has multiple goals:
|-|-|-|
| `addBindingResult` | `false` | Adds BindingResult to Api method definitions' request bodies if UseBeanValidation true, for this to be effective you must configure UseBeanValidation, this is not done automatically |
| `addServletRequest` | `false` | Adds ServletRequest objects to API method definitions |
| `useClassLevelBeanValidation` | `false` | Adds @Validated annotation to API interfaces |
| `useLombokAnnotations` | `false` | Use Lombok annotations to generate properties accessors and `hashCode`/`equals`/`toString` methods |
| `useSetForUniqueItems` | `false` | Use `java.util.Set` for arrays that has the attribute `uniqueItems` to `true` |
| `openApiNullable` | `true` | Whether to use the `jackson-databind-nullable` library |
| `useWithModifiers` | `false` | Generates bean `with` modifiers for fluent style |
| `useProtectedFields` | `false` | Whether to use protected visibility for model fields |

## Java Code Generator

| Option | Default | Description |
|-|-|-|
| `createApiComponent` | `true` | Whether to generate the client as a Spring component (`resttemplate` only) |
| `restTemplateBeanName` | `none` | The qualifier of the `RestTemplate` used by the `ApiClient` (`resttemplate` only) |
| `useClassLevelBeanValidation` | `false` | Adds @Validated annotation to API interfaces |
| `useJacksonConversion` | `false` | Use Jackson to convert query parameters (`resttemplate` only) |
| `useSetForUniqueItems` | `false` | Use `java.util.Set` for arrays that has the attribute `uniqueItems` to `true` |
| `useProtectedFields` | `false` | "Whether to use protected visibility for model fields |
5 changes: 3 additions & 2 deletions boat-scaffold/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
</parent>

<artifactId>boat-scaffold</artifactId>
Expand Down Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-trail-resources</artifactId>
<version>0.17.75-SNAPSHOT</version>
<version>0.18.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -161,6 +161,7 @@
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<version>${maven.resolver.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.javaparser</groupId>
Expand Down
Loading