mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 04:30:51 +00:00
adjust jersey2/jersey3 templates (#21171)
* respect useJakartaEE in jersey3 * useJakarteEE=true in jersey3 samples * don't force jakarta package for jersey3 * adjust whitespace between jersey2 and jersey3 * enforce useJakartaEe for jersey3, warn on misuse for jersey 2 * set useJakartaEe for jersey3, generate samples
This commit is contained in:
parent
3fadfe3889
commit
9a289e9713
@ -587,6 +587,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
// The flag below should be set for all Java libraries, but the templates need to be ported
|
||||
// one by one for each library.
|
||||
supportsAdditionalPropertiesWithComposedSchema = true;
|
||||
if (useJakartaEe) {
|
||||
LOGGER.warn("Jersey 2 is not compatible with Jakarta EE. Please use Jersey 3 or set {} to false.", USE_JAKARTA_EE);
|
||||
}
|
||||
} else if (libJersey3) {
|
||||
additionalProperties.put("jersey3", true);
|
||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||
@ -603,6 +606,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
||||
// The flag below should be set for all Java libraries, but the templates need to be ported
|
||||
// one by one for each library.
|
||||
supportsAdditionalPropertiesWithComposedSchema = true;
|
||||
setUseJakartaEe(true);
|
||||
applyJakartaPackage();
|
||||
} else if (libNative) {
|
||||
supportingFiles.add(new SupportingFile("ApiResponse.mustache", invokerFolder, "ApiResponse.java"));
|
||||
|
@ -1021,7 +1021,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -1386,7 +1386,7 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
||||
protected Client buildHttpClient() {
|
||||
// Create ClientConfig if it has not been initialized yet
|
||||
if (clientConfig == null) {
|
||||
clientConfig = getDefaultClientConfig();
|
||||
clientConfig = getDefaultClientConfig();
|
||||
}
|
||||
|
||||
ClientBuilder clientBuilder = ClientBuilder.newBuilder();
|
||||
|
@ -12,8 +12,8 @@ import {{javaxPackage}}.ws.rs.core.GenericType;
|
||||
{{/imports}}
|
||||
|
||||
{{#useBeanValidation}}
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.Valid;
|
||||
import {{javaxPackage}}.validation.constraints.*;
|
||||
import {{javaxPackage}}.validation.Valid;
|
||||
|
||||
{{/useBeanValidation}}
|
||||
import java.util.ArrayList;
|
||||
|
@ -17,8 +17,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
{{#useBeanValidation}}
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.Valid;
|
||||
import {{javaxPackage}}.validation.constraints.*;
|
||||
import {{javaxPackage}}.validation.Valid;
|
||||
|
||||
{{/useBeanValidation}}
|
||||
/**
|
||||
|
@ -152,7 +152,6 @@ dependencies {
|
||||
{{#useReflectionEqualsHashCode}}
|
||||
implementation "org.apache.commons:commons-lang3:$commons_lang3_version"
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
{{/parcelableModel}}
|
||||
{{#useBeanValidation}}
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.Valid;
|
||||
import {{javaxPackage}}.validation.constraints.*;
|
||||
import {{javaxPackage}}.validation.Valid;
|
||||
{{/useBeanValidation}}
|
||||
{{#performBeanValidation}}
|
||||
import org.hibernate.validator.constraints.*;
|
||||
|
@ -408,8 +408,14 @@
|
||||
<jackson-version>2.17.1</jackson-version>
|
||||
<jackson-databind-version>2.17.1</jackson-databind-version>
|
||||
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
|
||||
{{#useJakartaEe}}
|
||||
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
|
||||
<beanvalidation-version>3.0.2</beanvalidation-version>
|
||||
{{/useJakartaEe}}
|
||||
{{^useJakartaEe}}
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useJakartaEe}}
|
||||
<junit-version>5.10.0</junit-version>
|
||||
{{#hasHttpSignatureMethods}}
|
||||
<http-signature-version>1.8</http-signature-version>
|
||||
|
@ -800,7 +800,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -800,7 +800,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -941,7 +941,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -941,7 +941,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -121,7 +121,6 @@ dependencies {
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
@ -1142,7 +1142,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
protected Client buildHttpClient() {
|
||||
// Create ClientConfig if it has not been initialized yet
|
||||
if (clientConfig == null) {
|
||||
clientConfig = getDefaultClientConfig();
|
||||
clientConfig = getDefaultClientConfig();
|
||||
}
|
||||
|
||||
ClientBuilder clientBuilder = ClientBuilder.newBuilder();
|
||||
|
@ -129,7 +129,6 @@ dependencies {
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version"
|
||||
implementation "org.apache.commons:commons-lang3:$commons_lang3_version"
|
||||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
||||
}
|
||||
|
@ -1381,7 +1381,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
protected Client buildHttpClient() {
|
||||
// Create ClientConfig if it has not been initialized yet
|
||||
if (clientConfig == null) {
|
||||
clientConfig = getDefaultClientConfig();
|
||||
clientConfig = getDefaultClientConfig();
|
||||
}
|
||||
|
||||
ClientBuilder clientBuilder = ClientBuilder.newBuilder();
|
||||
|
@ -849,7 +849,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -800,7 +800,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -925,7 +925,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -925,7 +925,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
@ -1023,7 +1023,7 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Adds the object with the provided key to the MultiPart.
|
||||
* Based on the object type sets Content-Disposition and Content-Type.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user