Compare commits

..

5 Commits

Author SHA1 Message Date
William Cheng
696c8fffc2 fix key file 2023-02-20 00:39:54 +08:00
William Cheng
21cc487175 fix 2023-02-20 00:14:22 +08:00
William Cheng
17668922f2 fix 2023-02-20 00:06:18 +08:00
William Cheng
622071e70e fix gradle publish 2023-02-19 19:40:12 +08:00
William Cheng
617c53d65d fix 6.4.0 release - docker 2023-02-19 19:30:04 +08:00
1483 changed files with 1836 additions and 3166 deletions

View File

@@ -1,35 +0,0 @@
name: Samples Erlang
on:
push:
paths:
# comment out due to errors
# ===> Compiling src/openapi_pet_handler.erl failed
# src/openapi_pet_handler.erl:278: function is_authorized/2 already defined
#- samples/server/petstore/erlang-server/**
- samples/client/petstore/erlang-client/**
- samples/client/petstore/erlang-proper/**
pull_request:
paths:
#- samples/server/petstore/erlang-server/**
- samples/client/petstore/erlang-client/**
- samples/client/petstore/erlang-proper/**
jobs:
build:
name: Build Erlang projects
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
sample:
#- samples/server/petstore/erlang-server/
- samples/client/petstore/erlang-client/
- samples/client/petstore/erlang-proper/
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: '22.2'
rebar3-version: '3.14.3'
- run: rebar3 compile
working-directory: ${{ matrix.sample }}

View File

@@ -121,6 +121,9 @@ before_install:
- cat /etc/hosts
# show java version
- java -version
- export TRAVIS_TAG=v6.4.0
- export TRAVIS_BRANCH=master
- export TRAVIS_PULL_REQUEST=false
- if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
openssl aes-256-cbc -K $encrypted_6e2c8bba47c6_key -iv $encrypted_6e2c8bba47c6_iv -in sec.gpg.enc -out sec.gpg -d ;
gpg --keyserver keyserver.ubuntu.com --recv-key $SIGNING_KEY ;
@@ -153,27 +156,11 @@ script:
- mvn -e --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
#- mvn -e --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
after_success:
- export TRAVIS_TAG=v6.4.0
- export TRAVIS_BRANCH=master
- export TRAVIS_PULL_REQUEST=false
# push to maven repo
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
echo "Publishing from branch $TRAVIS_BRANCH";
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository;
echo "Finished ./gradlew publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository";
popd;
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
echo "Publishing from branch $TRAVIS_BRANCH";
mvn clean deploy --settings CI/settings.xml;
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
pushd .;
cd modules/openapi-generator-gradle-plugin;
./gradlew -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository;
echo "Finished ./gradlew publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository";
popd;
fi;
if [ -n $TRAVIS_TAG ] && [[ "$TRAVIS_TAG" =~ ^[v][0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Publishing the gradle plugin to Gradle Portal on tag $TRAVIS_TAG (only)";
pushd .;

View File

@@ -477,31 +477,3 @@ Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyAnyOfStringAndEnumString_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING=true
```
- `SIMPLIFY_BOOLEAN_ENUM`: when set to `true`, convert boolean enum to just enum.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyBooleanEnum_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_BOOLEAN_ENUM=true
```
- `SIMPLIFY_ONEOF_ANYOF`: when set to `true`, simplify oneOf/anyOf by 1) removing null (sub-schema) and setting nullable to true instead, and 2) simplifying oneOf/anyOf with a single sub-schema to just the sub-schema itself.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/simplifyOneOfAnyOf_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SIMPLIFY_ONEOF_ANYOF=true
```
- `KEEP_ONLY_FIRST_TAG_IN_OPERATION`: when set to `true`, only keep the first tag in operation if there are more than one tag defined.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer KEEP_ONLY_FIRST_TAG_IN_OPERATION=true
```
- `SET_TAGS_FOR_ALL_OPERATIONS`: when set to a string value, tags in all operatinos will reset to the string value provided.
Example:
```
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml -o /tmp/java-okhttp/ --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=true
```

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -6,7 +6,7 @@
<artifactId>openapi-generator-project</artifactId>
<groupId>org.openapitools</groupId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -3,7 +3,7 @@ import io.github.gradlenexus.publishplugin.ReleaseNexusStagingRepository
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.gradle.plugin-publish") version "1.0.0"
id("com.gradle.plugin-publish") version "1.1.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("java-gradle-plugin")
id("maven-publish")
@@ -113,7 +113,7 @@ nexusPublishing {
// or stored as key=value pairs in ~/.gradle/gradle.properties
// You can also apply them in CI via environment variables. See Gradle's docs for details.
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publishPluginMavenPublicationToSonatypeRepository") }
//required { isReleaseVersion && gradle.taskGraph.hasTask("publishPluginMavenPublicationToSonatypeRepository") }
sign(publishing.publications)
}

View File

@@ -1,5 +1,5 @@
# RELEASE_VERSION
openApiGeneratorVersion=6.5.0-SNAPSHOT
openApiGeneratorVersion=6.4.0
# /RELEASE_VERSION
# BEGIN placeholders

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>
@@ -81,6 +81,9 @@
<gradleVersion>${gradleVersion}</gradleVersion>
<args>
<arg>-P openApiGeneratorVersion=${project.version}</arg>
<arg>-Psigning.keyId=${env.SIGNING_KEY}</arg>
<arg>-Psigning.password=${env.SIGNING_PASSPHRASE}</arg>
<arg>-Psigning.secretKeyRingFile=${env.TRAVIS_BUILD_DIR}/sec.gpg</arg>v
</args>
</configuration>
<executions>

View File

@@ -1,3 +1,3 @@
# RELEASE_VERSION
openApiGeneratorVersion=6.5.0-SNAPSHOT
openApiGeneratorVersion=6.4.0
# /RELEASE_VERSION

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -15,7 +15,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -19,7 +19,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<dependencies>
<dependency>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -13,7 +13,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -20,7 +20,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>

View File

@@ -5,7 +5,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>
@@ -12,7 +12,7 @@
<packaging>jar</packaging>
<name>openapi-generator-online</name>
<properties>
<spring-boot.version>2.5.14</spring-boot.version>
<spring-boot.version>2.7.5</spring-boot.version>
<springfox-version>3.0.0</springfox-version>
<sonar.exclusions>**/org/openapitools/codegen/online/**/*</sonar.exclusions>
</properties>

View File

@@ -4,7 +4,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-project</artifactId>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<relativePath>../..</relativePath>
</parent>

View File

@@ -3877,12 +3877,8 @@ public class DefaultCodegen implements CodegenConfig {
}
}
// set isNullable using nullable or x-nullable in the schema
if (referencedSchema.getNullable() != null) {
property.isNullable = referencedSchema.getNullable();
} else if (referencedSchema.getExtensions() != null &&
referencedSchema.getExtensions().containsKey("x-nullable")) {
property.isNullable = (Boolean) referencedSchema.getExtensions().get("x-nullable");
}
property.dataType = getTypeDeclaration(p);

View File

@@ -39,7 +39,7 @@ public class OpenAPINormalizer {
final Logger LOGGER = LoggerFactory.getLogger(OpenAPINormalizer.class);
// ============= a list of rules =============
// when set to true, all rules (true or false) are enabled
// when set to true, all rules are enabled
final String ALL = "ALL";
boolean enableAll;
@@ -63,19 +63,6 @@ public class OpenAPINormalizer {
final String SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING = "SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING";
boolean simplifyAnyOfStringAndEnumString;
// when set to true, oneOf/anyOf schema with only one sub-schema is simplified to just the sub-schema
// and if sub-schema contains "null", remove it and set nullable to true instead
final String SIMPLIFY_ONEOF_ANYOF = "SIMPLIFY_ONEOF_ANYOF";
boolean simplifyOneOfAnyOf;
// when set to true, boolean enum will be converted to just boolean
final String SIMPLIFY_BOOLEAN_ENUM = "SIMPLIFY_BOOLEAN_ENUM";
boolean simplifyBooleanEnum;
// when set to a string value, tags in all operations will be reset to the string value provided
final String SET_TAGS_FOR_ALL_OPERATIONS = "SET_TAGS_FOR_ALL_OPERATIONS";
String setTagsForAllOperations;
// ============= end of rules =============
/**
@@ -119,19 +106,6 @@ public class OpenAPINormalizer {
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING))) {
simplifyAnyOfStringAndEnumString = true;
}
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_ONEOF_ANYOF))) {
simplifyOneOfAnyOf = true;
}
if (enableAll || "true".equalsIgnoreCase(rules.get(SIMPLIFY_BOOLEAN_ENUM))) {
simplifyBooleanEnum = true;
}
if (StringUtils.isNotEmpty(rules.get(SET_TAGS_FOR_ALL_OPERATIONS))) {
setTagsForAllOperations = rules.get(SET_TAGS_FOR_ALL_OPERATIONS);
}
}
/**
@@ -195,8 +169,6 @@ public class OpenAPINormalizer {
*/
private void normalizeOperation(Operation operation) {
processKeepOnlyFirstTagInOperation(operation);
processSetTagsForAllOperations(operation);
}
/**
@@ -329,11 +301,11 @@ public class OpenAPINormalizer {
visitedSchemas.add(schema);
}
if (schema instanceof ArraySchema) { // array
if (schema instanceof ArraySchema) {
normalizeSchema(schema.getItems(), visitedSchemas);
} else if (schema.getAdditionalProperties() instanceof Schema) { // map
normalizeSchema((Schema) schema.getAdditionalProperties(), visitedSchemas);
} else if (ModelUtils.isComposedSchema(schema)) { // composed schema
} else if (ModelUtils.isComposedSchema(schema)) {
ComposedSchema cs = (ComposedSchema) schema;
if (ModelUtils.isComplexComposedSchema(cs)) {
@@ -365,8 +337,6 @@ public class OpenAPINormalizer {
normalizeSchema(schema.getNot(), visitedSchemas);
} else if (schema.getProperties() != null && !schema.getProperties().isEmpty()) {
normalizeProperties(schema.getProperties(), visitedSchemas);
} else if (schema instanceof BooleanSchema) {
normalizeBooleanSchema(schema, visitedSchemas);
} else if (schema instanceof Schema) {
normalizeSchemaWithOnlyProperties(schema, visitedSchemas);
} else {
@@ -376,10 +346,6 @@ public class OpenAPINormalizer {
return schema;
}
private void normalizeBooleanSchema(Schema schema, Set<Schema> visitedSchemas) {
processSimplifyBooleanEnum(schema);
}
private void normalizeSchemaWithOnlyProperties(Schema schema, Set<Schema> visitedSchemas) {
// normalize non-composed schema (e.g. schema with only properties)
}
@@ -410,36 +376,27 @@ public class OpenAPINormalizer {
private Schema normalizeOneOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getOneOf()) {
if (item == null) {
continue;
}
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! oneOf schema is not of the type Schema: " + item);
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize oenOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
schema = processSimplifyOneOf(schema);
// process rules here
return schema;
}
private Schema normalizeAnyOf(Schema schema, Set<Schema> visitedSchemas) {
for (Object item : schema.getAnyOf()) {
if (item == null) {
continue;
}
if (!(item instanceof Schema)) {
throw new RuntimeException("Error! anyOf schema is not of the type Schema: " + item);
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
}
// normalize anyOf sub schemas one by one
normalizeSchema((Schema) item, visitedSchemas);
}
// process rules here
schema = processSimplifyAnyOf(schema);
// last rule to process as the schema may become String schema (not "anyOf") after the completion
return processSimplifyAnyOfStringAndEnumString(schema);
@@ -512,20 +469,6 @@ public class OpenAPINormalizer {
}
}
/**
* Set the tag name for all operations
*
* @param operation Operation
*/
private void processSetTagsForAllOperations(Operation operation) {
if (StringUtils.isEmpty(setTagsForAllOperations)) {
return;
}
operation.setTags(null);
operation.addTagsItem(setTagsForAllOperations);
}
/**
* If the schema contains anyOf/oneOf and properties, remove oneOf/anyOf as these serve as rules to
* ensure inter-dependency between properties. It's a workaround as such validation is not supported at the moment.
@@ -533,6 +476,7 @@ public class OpenAPINormalizer {
* @param schema Schema
*/
private void processRemoveAnyOfOneOfAndKeepPropertiesOnly(Schema schema) {
if (!removeAnyOfOneOfAndKeepPropertiesOnly && !enableAll) {
return;
}
@@ -549,7 +493,7 @@ public class OpenAPINormalizer {
/**
* If the schema is anyOf and the sub-schemas are either string or enum of string,
* then simplify it to just string as many generators do not yet support anyOf.
* then simply it to just string as many generators do not yet support anyOf.
*
* @param schema Schema
* @return Schema
@@ -559,11 +503,6 @@ public class OpenAPINormalizer {
return schema;
}
if (schema.getAnyOf() == null) {
// ComposedSchema, Schema with `type: null`
return schema;
}
Schema s0 = null, s1 = null;
if (schema.getAnyOf().size() == 2) {
s0 = ModelUtils.unaliasSchema(openAPI, (Schema) schema.getAnyOf().get(0));
@@ -589,91 +528,5 @@ public class OpenAPINormalizer {
}
}
/**
* If the schema is oneOf and the sub-schemas is null, set `nullable: true` instead.
* If there's only one sub-schema, simply return the sub-schema directly.
*
* @param schema Schema
* @return Schema
*/
private Schema processSimplifyOneOf(Schema schema) {
if (!simplifyOneOfAnyOf && !enableAll) {
return schema;
}
if (schema.getOneOf() != null && !schema.getOneOf().isEmpty()) {
// convert null sub-schema to `nullable: true`
for (int i = 0; i < schema.getOneOf().size(); i++) {
if (schema.getOneOf().get(i) == null || ((Schema) schema.getOneOf().get(i)).getType() == null) {
schema.getOneOf().remove(i);
schema.setNullable(true);
}
}
// if only one element left, simplify to just the element (schema)
if (schema.getOneOf().size() == 1) {
if (schema.getNullable()) { // retain nullable setting
((Schema) schema.getOneOf().get(0)).setNullable(true);
}
return (Schema) schema.getOneOf().get(0);
}
}
return schema;
}
/**
* If the schema is anyOf and the sub-schemas is null, set `nullable: true` instead.
* If there's only one sub-schema, simply return the sub-schema directly.
*
* @param schema Schema
* @return Schema
*/
private Schema processSimplifyAnyOf(Schema schema) {
if (!simplifyOneOfAnyOf && !enableAll) {
return schema;
}
if (schema.getAnyOf() != null && !schema.getAnyOf().isEmpty()) {
// convert null sub-schema to `nullable: true`
for (int i = 0; i < schema.getAnyOf().size(); i++) {
if (schema.getAnyOf().get(i) == null || ((Schema) schema.getAnyOf().get(i)).getType() == null) {
schema.getAnyOf().remove(i);
schema.setNullable(true);
}
}
// if only one element left, simplify to just the element (schema)
if (schema.getAnyOf().size() == 1) {
if (schema.getNullable()) { // retain nullable setting
((Schema) schema.getAnyOf().get(0)).setNullable(true);
}
return (Schema) schema.getAnyOf().get(0);
}
}
return schema;
}
/**
* If the schema is boolean and its enum is defined,
* then simply it to just boolean.
*
* @param schema Schema
* @return Schema
*/
private void processSimplifyBooleanEnum(Schema schema) {
if (!simplifyBooleanEnum && !enableAll) {
return;
}
if (schema instanceof BooleanSchema) {
BooleanSchema bs = (BooleanSchema) schema;
if (bs.getEnum() != null && !bs.getEnum().isEmpty()) { // enum defined
bs.setEnum(null);
}
}
}
// ===================== end of rules =====================
}

View File

@@ -403,20 +403,23 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
}
if (cp.isArray) {
String constraints = "";
if (cp.maxItems != null) {
constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
if (cp.maxItems != null || cp.minItems != null) {
String maxOrMinItems = "";
if (cp.maxItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
}
if (cp.minItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
pydanticImports.add("conlist");
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
maxOrMinItems);
} else {
typingImports.add("List");
return String.format(Locale.ROOT, "List[%s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
}
if (cp.minItems != null) {
constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
if (cp.getUniqueItems()) {
constraints += ", unique_items=True";
}
pydanticImports.add("conlist");
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
constraints);
} else if (cp.isMap) {
typingImports.add("Dict");
return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
@@ -650,21 +653,22 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
return String.format(Locale.ROOT, "%sEnum", cp.nameInCamelCase);
} else*/
if (cp.isArray) {
String constraints = "";
if (cp.maxItems != null) {
constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
if (cp.maxItems != null || cp.minItems != null) {
String maxOrMinItems = "";
if (cp.maxItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
}
if (cp.minItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
pydanticImports.add("conlist");
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
maxOrMinItems);
} else {
typingImports.add("List");
return String.format(Locale.ROOT, "List[%s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
}
if (cp.minItems != null) {
constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
if (cp.getUniqueItems()) {
constraints += ", unique_items=True";
}
pydanticImports.add("conlist");
typingImports.add("List"); // for return type
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
constraints);
} else if (cp.isMap) {
typingImports.add("Dict");
return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
@@ -880,6 +884,10 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fields.add(String.format(Locale.ROOT, "description=\"%s\"", param.description));
}
if (param.isArray && param.getUniqueItems()) { // a set
fields.add("unique_items=True");
}
/* TODO support example
if (!StringUtils.isEmpty(cp.getExample())) { // has example
fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample()));
@@ -1063,6 +1071,10 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fields.add(String.format(Locale.ROOT, "description=\"%s\"", cp.description));
}
if (cp.isArray && cp.getUniqueItems()) { // a set
fields.add("unique_items=True");
}
/* TODO review as example may break the build
if (!StringUtils.isEmpty(cp.getExample())) { // has example
fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample()));

View File

@@ -21,6 +21,14 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.servers.Server;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
@@ -36,7 +44,7 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import io.swagger.v3.oas.models.tags.Tag;
import org.apache.commons.lang3.tuple.Pair;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
@@ -70,17 +78,6 @@ import org.openapitools.codegen.utils.URLPathUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.Parameter;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.tags.Tag;
public class SpringCodegen extends AbstractJavaCodegen
implements BeanValidationFeatures, PerformBeanValidationFeatures, OptionalFeatures, SwaggerUIFeatures {
private final Logger LOGGER = LoggerFactory.getLogger(SpringCodegen.class);
@@ -1199,60 +1196,4 @@ public class SpringCodegen extends AbstractJavaCodegen
public void setRequestMappingMode(RequestMappingMode requestMappingMode) {
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() || !codegenProperty.isModel || isResponseType(codegenProperty)) {
return dataType;
}
if (StringUtils.isEmpty( dataType ) || dataType.contains( "@Valid" )) {
return dataType;
}
return dataType.replace( "<", "<@Valid " );
}
// 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

@@ -117,7 +117,7 @@ ext {
jackson_version = "2.12.6"
jackson_databind_version = "2.12.6.1"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
jersey_version = "1.19.4"

View File

@@ -117,7 +117,7 @@ ext {
jackson_version = "2.14.1"
jackson_databind_version = "2.14.1"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
httpclient_version = "5.1.3"

View File

@@ -336,7 +336,7 @@
<jackson-version>2.14.1</jackson-version>
<jackson-databind-version>2.14.1</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

View File

@@ -105,7 +105,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
feign_version = "10.11"

View File

@@ -383,7 +383,7 @@
<gson-version>2.8.6</gson-version>
{{/gson}}
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
<jackson-databind-version>2.13.4.2</jackson-databind-version>
{{#useJakartaEe}}

View File

@@ -101,7 +101,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
google_api_client_version = "1.32.2"

View File

@@ -302,7 +302,7 @@
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#joda}}
<jodatime-version>2.9.9</jodatime-version>

View File

@@ -1249,11 +1249,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
{{#hasOAuthMethods}}
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (response.getStatusInfo() == Status.UNAUTHORIZED) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1269,9 +1267,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
{{/hasOAuthMethods}}
int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (statusCode == Status.NO_CONTENT.getStatusCode()) {
if (response.getStatusInfo() == Status.NO_CONTENT) {
return new ApiResponse<T>(statusCode, responseHeaders);
} else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
if (returnType == null) {

View File

@@ -102,7 +102,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
jersey_version = "2.35"

View File

@@ -24,7 +24,7 @@ lazy val root = (project in file(".")).
{{/joda}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4" % "compile",
{{/openApiNullable}}
{{#hasOAuthMethods}}
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",

View File

@@ -386,7 +386,7 @@
<jersey-version>2.35</jersey-version>
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}

View File

@@ -1249,11 +1249,9 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
try {
response = sendRequest(method, invocationBuilder, entity);
final int statusCode = response.getStatusInfo().getStatusCode();
{{#hasOAuthMethods}}
// If OAuth is used and a status 401 is received, renew the access token and retry the request
if (statusCode == Status.UNAUTHORIZED.getStatusCode()) {
if (response.getStatusInfo() == Status.UNAUTHORIZED) {
for (String authName : authNames) {
Authentication authentication = authentications.get(authName);
if (authentication instanceof OAuth) {
@@ -1269,9 +1267,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
}
{{/hasOAuthMethods}}
int statusCode = response.getStatusInfo().getStatusCode();
Map<String, List<String>> responseHeaders = buildResponseHeaders(response);
if (statusCode == Status.NO_CONTENT.getStatusCode()) {
if (response.getStatusInfo() == Status.NO_CONTENT) {
return new ApiResponse<T>(statusCode, responseHeaders);
} else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) {
if (returnType == null) {

View File

@@ -102,7 +102,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "2.1.0"
jersey_version = "3.0.4"

View File

@@ -24,7 +24,7 @@ lazy val root = (project in file(".")).
{{/joda}}
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.2" % "compile",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6" % "compile",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4" % "compile",
{{/openApiNullable}}
{{#hasOAuthMethods}}
"com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile",

View File

@@ -386,7 +386,7 @@
<jersey-version>3.0.4</jersey-version>
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jakarta-annotation-version>2.1.0</jakarta-annotation-version>
{{#useBeanValidation}}
<beanvalidation-version>2.0.2</beanvalidation-version>

View File

@@ -273,7 +273,7 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<jackson-version>2.14.1</jackson-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}

View File

@@ -119,7 +119,7 @@ dependencies {
implementation 'javax.ws.rs:jsr311-api:1.1.1'
implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1'
{{#openApiNullable}}
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation 'org.openapitools:jackson-databind-nullable:0.2.4'
{{/openApiNullable}}
{{#hasOAuthMethods}}
implementation group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.2'

View File

@@ -17,7 +17,7 @@ lazy val root = (project in file(".")).
"javax.ws.rs" % "jsr311-api" % "1.1.1",
"javax.ws.rs" % "javax.ws.rs-api" % "2.1.1",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4",
{{/openApiNullable}}
{{#hasOAuthMethods}}
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.2",

View File

@@ -416,7 +416,7 @@
<gson-version>2.9.1</gson-version>
<commons-lang3-version>3.12.0</commons-lang3-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#joda}}
<jodatime-version>2.12.0</jodatime-version>

View File

@@ -104,7 +104,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
{{/jackson}}

View File

@@ -18,7 +18,7 @@ lazy val root = (project in file(".")).
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.13.4",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.13.4.2",
{{#openApiNullable}}
"org.openapitools" % "jackson-databind-nullable" % "0.2.6",
"org.openapitools" % "jackson-databind-nullable" % "0.2.4",
{{/openApiNullable}}
{{#withXml}}
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-xml" % "2.13.4.1",

View File

@@ -342,7 +342,7 @@
{{#jackson}}
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/jackson}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

View File

@@ -101,7 +101,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
threetenbp_version = "2.9.10"

View File

@@ -284,7 +284,7 @@
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

View File

@@ -2,9 +2,9 @@ package {{invokerPackage}}.auth;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import org.springframework.http.HttpHeaders;
import org.springframework.util.Base64Utils;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}
@@ -34,6 +34,6 @@ public class HttpBasicAuth implements Authentication {
return;
}
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8)));
}
}

View File

@@ -4,6 +4,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.springframework.http.HttpHeaders;
import org.springframework.util.Base64Utils;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}

View File

@@ -101,7 +101,7 @@ ext {
jackson_version = "2.14.1"
jackson_databind_version = "2.14.1"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
spring_web_version = "5.3.24"

View File

@@ -324,7 +324,7 @@
<jackson-version>2.14.1</jackson-version>
<jackson-databind-version>2.14.1</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>

View File

@@ -103,7 +103,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
play_version = "2.6.7"
{{/usePlayWS}}

View File

@@ -367,7 +367,7 @@
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<play-version>2.6.7</play-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{/usePlayWS}}
<retrofit-version>2.5.0</retrofit-version>

View File

@@ -35,7 +35,7 @@ ext {
vertx_version = "3.4.2"
junit_version = "4.13.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
}

View File

@@ -296,7 +296,7 @@
<swagger-annotations-version>1.6.6</swagger-annotations-version>
<jackson-version>2.13.4</jackson-version>
<jackson-databind>2.13.4.2</jackson-databind>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{#useJakartaEe}}
<jakarta-annotation-version>2.1.1</jakarta-annotation-version>
{{/useJakartaEe}}

View File

@@ -2,9 +2,9 @@ package {{invokerPackage}}.auth;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import org.springframework.http.HttpHeaders;
import org.springframework.util.Base64Utils;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}
@@ -34,6 +34,6 @@ public class HttpBasicAuth implements Authentication {
return;
}
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8)));
}
}

View File

@@ -4,6 +4,7 @@ import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.springframework.http.HttpHeaders;
import org.springframework.util.Base64Utils;
import org.springframework.util.MultiValueMap;
{{>generatedAnnotation}}

View File

@@ -117,7 +117,7 @@ ext {
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
{{#openApiNullable}}
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
{{/openApiNullable}}
jakarta_annotation_version = "1.3.5"
reactor_version = "3.4.3"

View File

@@ -158,7 +158,7 @@
<jackson-version>2.13.4</jackson-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
{{#openApiNullable}}
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
{{/openApiNullable}}
{{#useJakartaEe}}
<spring-boot-version>3.0.1</spring-boot-version>

View File

@@ -186,7 +186,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.2</version>
</dependency>
{{/openApiNullable}}
{{#useBeanValidation}}

View File

@@ -196,7 +196,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.2</version>
</dependency>
{{/openApiNullable}}
{{#useBeanValidation}}

View File

@@ -120,7 +120,7 @@
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
{{^parentOverridden}}
<version>0.2.6</version>
<version>0.2.2</version>
{{/parentOverridden}}
</dependency>
{{/openApiNullable}}

View File

@@ -136,7 +136,7 @@
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
{{^parentOverridden}}
<version>0.2.6</version>
<version>0.2.2</version>
{{/parentOverridden}}
</dependency>
{{/openApiNullable}}

View File

@@ -86,7 +86,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.2</version>
</dependency>
{{/openApiNullable}}
<dependency>

View File

@@ -38,7 +38,7 @@ pplx::task<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{classname}}::{{
std::shared_ptr<const ApiConfiguration> localVarApiConfiguration( m_ApiClient->getConfiguration() );
utility::string_t localVarPath = utility::conversions::to_string_t("{{{path}}}");
{{#pathParams}}boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("{{baseName}}") + utility::conversions::to_string_t("}"), web::uri::encode(ApiClient::parameterToString({{{paramName}}})));
{{#pathParams}}boost::replace_all(localVarPath, utility::conversions::to_string_t("{") + utility::conversions::to_string_t("{{baseName}}") + utility::conversions::to_string_t("}"), ApiClient::parameterToString({{{paramName}}}));
{{/pathParams}}
std::map<utility::string_t, utility::string_t> localVarQueryParams;

View File

@@ -18,7 +18,7 @@
-spec {{operationId}}(ctx:ctx(){{#allParams}}{{#required}}, {{{dataType}}}{{/required}}{{/allParams}}, maps:map()) -> {ok, {{{returnType}}}{{^returnType}}[]{{/returnType}}, {{packageName}}_utils:response_info()} | {ok, hackney:client_ref()} | {error, term(), {{packageName}}_utils:response_info()}.
{{operationId}}(Ctx{{#allParams}}{{#required}}, {{paramName}}{{/required}}{{/allParams}}, Optional) ->
_OptionalParams = maps:get(params, Optional, #{}),
Cfg = maps:get(cfg, Optional, application:get_env({{packageName}}_api, config, #{})),
Cfg = maps:get(cfg, Optional, application:get_env(kuberl, config, #{})),
Method = {{httpMethod}},
Path = [<<"{{{replacedPathName}}}">>],

View File

@@ -116,7 +116,7 @@ Do not edit the class manually.
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.4</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>

View File

@@ -45,7 +45,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.2</version>
</dependency>
{{/jackson}}
{{#jsonb}}

View File

@@ -42,7 +42,7 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.6</version>
<version>0.2.2</version>
</dependency>
{{/jackson}}
{{#jsonb}}

View File

@@ -69,8 +69,8 @@ import com.fasterxml.jackson.databind.ObjectMapper
{{/isString}}
{{/isArray}}
{{#isArray}}
for (x in {{paramName}} ?: listOf()) {
append("{{{baseName}}}", x.toString())
for (int i=0; i < {{paramName}}.size(); i++) {
{{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.get(i).toString()) }
}
{{/isArray}}
{{/isFile}}
@@ -98,8 +98,8 @@ import com.fasterxml.jackson.databind.ObjectMapper
{{/isString}}
{{/isArray}}
{{#isArray}}
for (x in {{paramName}} ?: listOf()) {
append("{{{baseName}}}", x.toString())
for (int i=0; i < {{paramName}}.size(); i++) {
{{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.get(i).toString()) }
}
{{/isArray}}
{{/isFile}}

View File

@@ -549,8 +549,6 @@ class ApiClient(object):
v = str(v)
if isinstance(v, bool):
v = str(v).lower()
if isinstance(v, dict):
v = json.dumps(v)
if k in collection_formats:
collection_format = collection_formats[k]

View File

@@ -79,10 +79,6 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
else:
return v
@classmethod
def from_dict(cls, obj: dict) -> {{{classname}}}:
return cls.from_json(json.dumps(obj))
@classmethod
def from_json(cls, json_str: str) -> {{{classname}}}:
"""Returns the object represented by the json string"""

View File

@@ -59,11 +59,6 @@ module {{moduleName}}
# @return [Proc]
attr_accessor :access_token_getter
# Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
# HTTP responses with return type `File` will be returned as a stream of binary data.
# Default to false.
attr_accessor :return_binary_data
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
# details will be logged with `logger.debug` (see the `logger` attribute).
# Default to false.

View File

@@ -359,7 +359,6 @@
{{/-first}}
{{^isMap}}
{{^required}}
#[allow(clippy::single_match)]
match param_{{{paramName}}} {
Some(param_{{{paramName}}}) => {
{{/required}}

View File

@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
use async_trait::async_trait;
use futures::Stream;

View File

@@ -189,7 +189,7 @@ impl<'a> std::iter::IntoIterator for &'a {{{classname}}} {
type IntoIter = std::slice::Iter<'a, {{{arrayModelType}}}>;
fn into_iter(self) -> Self::IntoIter {
self.0.iter()
(&self.0).iter()
}
}
@@ -198,7 +198,7 @@ impl<'a> std::iter::IntoIterator for &'a mut {{{classname}}} {
type IntoIter = std::slice::IterMut<'a, {{{arrayModelType}}}>;
fn into_iter(self) -> Self::IntoIter {
self.0.iter_mut()
(&mut self.0).iter_mut()
}
}

View File

@@ -125,7 +125,7 @@
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
{{/-first}}
let param_{{{paramName}}} = query_params.iter().filter(|e| e.0 == "{{{baseName}}}").map(|e| e.1.clone())
let param_{{{paramName}}} = query_params.iter().filter(|e| e.0 == "{{{baseName}}}").map(|e| e.1.to_owned())
{{#isArray}}
{{^vendorExtensions.x-consumes-json}}
.filter_map(|param_{{{paramName}}}| param_{{{paramName}}}.parse().ok())
@@ -221,7 +221,7 @@
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
{{/x-consumes-xml}}
{{#x-consumes-json}}
let deserializer = &mut serde_json::Deserializer::from_slice(&body);
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
{{/x-consumes-json}}
{{^x-consumes-plain-text}}
match serde_ignored::deserialize(deserializer, |path| {

View File

@@ -58,7 +58,7 @@ reqwest = "~0.9"
{{/supportAsync}}
{{#supportAsync}}
{{#supportMiddleware}}
reqwest-middleware = "0.2.0"
reqwest-middleware = "0.1.6"
{{/supportMiddleware}}
[dependencies.reqwest]
version = "^0.11"

View File

@@ -4394,81 +4394,4 @@ public class DefaultCodegenTest {
assertNull(schema3.getAnyOf());
assertTrue(schema3 instanceof StringSchema);
}
@Test
public void testOpenAPINormalizerSimplifyOneOfAnyOf() {
// to test the rule SIMPLIFY_ONEOF_ANYOF
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/simplifyOneOfAnyOf_test.yaml");
Schema schema = openAPI.getComponents().getSchemas().get("AnyOfTest");
assertEquals(schema.getAnyOf().size(), 2);
assertNull(schema.getNullable());
Schema schema2 = openAPI.getComponents().getSchemas().get("OneOfTest");
assertEquals(schema2.getOneOf().size(), 2);
assertNull(schema2.getNullable());
Schema schema5 = openAPI.getComponents().getSchemas().get("OneOfNullableTest");
assertEquals(schema5.getOneOf().size(), 3);
assertNull(schema5.getNullable());
Map<String, String> options = new HashMap<>();
options.put("SIMPLIFY_ONEOF_ANYOF", "true");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
Schema schema3 = openAPI.getComponents().getSchemas().get("AnyOfTest");
assertNull(schema3.getAnyOf());
assertTrue(schema3 instanceof StringSchema);
assertTrue(schema3.getNullable());
Schema schema4 = openAPI.getComponents().getSchemas().get("OneOfTest");
assertNull(schema4.getOneOf());
assertTrue(schema4 instanceof IntegerSchema);
Schema schema6 = openAPI.getComponents().getSchemas().get("OneOfNullableTest");
assertEquals(schema6.getOneOf().size(), 2);
assertTrue(schema6.getNullable());
}
@Test
public void testOpenAPINormalizerSimplifyBooleanEnum() {
// to test the rule SIMPLIFY_BOOLEAN_ENUM
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/simplifyBooleanEnum_test.yaml");
Schema schema = openAPI.getComponents().getSchemas().get("BooleanEnumTest");
assertEquals(schema.getProperties().size(), 3);
assertTrue(schema.getProperties().get("boolean_enum") instanceof BooleanSchema);
BooleanSchema bs = (BooleanSchema) schema.getProperties().get("boolean_enum");
assertEquals(bs.getEnum().size(), 2);
Map<String, String> options = new HashMap<>();
options.put("SIMPLIFY_BOOLEAN_ENUM", "true");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
Schema schema3 = openAPI.getComponents().getSchemas().get("BooleanEnumTest");
assertEquals(schema.getProperties().size(), 3);
assertTrue(schema.getProperties().get("boolean_enum") instanceof BooleanSchema);
BooleanSchema bs2 = (BooleanSchema) schema.getProperties().get("boolean_enum");
assertNull(bs2.getEnum()); //ensure the enum has been erased
}
@Test
public void testOpenAPINormalizerSetTagsInAllOperations() {
OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/enableKeepOnlyFirstTagInOperation_test.yaml");
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getTags().size(), 2);
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getTags().size(), 1);
Map<String, String> options = new HashMap<>();
options.put("SET_TAGS_FOR_ALL_OPERATIONS", "core");
OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer(openAPI, options);
openAPINormalizer.normalize();
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getTags().size(), 1);
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getTags().size(), 1);
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getGet().getTags().get(0), "core");
assertEquals(openAPI.getPaths().get("/person/display/{personId}").getDelete().getTags().get(0), "core");
}
}

View File

@@ -21,7 +21,12 @@ import static java.util.stream.Collectors.groupingBy;
import static org.assertj.core.api.Assertions.assertThat;
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.assertFileNotContains;
import static org.openapitools.codegen.languages.SpringCodegen.*;
import static org.openapitools.codegen.languages.SpringCodegen.INTERFACE_ONLY;
import static org.openapitools.codegen.languages.SpringCodegen.REQUEST_MAPPING_OPTION;
import static org.openapitools.codegen.languages.SpringCodegen.RESPONSE_WRAPPER;
import static org.openapitools.codegen.languages.SpringCodegen.RETURN_SUCCESS_CODE;
import static org.openapitools.codegen.languages.SpringCodegen.SPRING_BOOT;
import static org.openapitools.codegen.languages.SpringCodegen.USE_SPRING_BOOT3;
import static org.openapitools.codegen.languages.features.DocumentationProviderFeatures.ANNOTATION_LIBRARY;
import static org.openapitools.codegen.languages.features.DocumentationProviderFeatures.DOCUMENTATION_PROVIDER;
import static org.testng.Assert.assertEquals;
@@ -45,8 +50,6 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.validation.Valid;
import org.openapitools.codegen.config.GlobalSettings;
import org.openapitools.codegen.java.assertions.JavaFileAssert;
import org.openapitools.codegen.CliOption;
@@ -652,63 +655,6 @@ public class SpringCodegenTest {
));
}
@Test
public void shouldAddValidAnnotationIntoCollectionWhenBeanValidationIsEnabled_issue14723() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/bugs/issue_14723.yaml", null, new ParseOptions()).getOpenAPI();
SpringCodegen codegen = new SpringCodegen();
codegen.setLibrary(SPRING_CLOUD_LIBRARY);
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(SpringCodegen.USE_BEANVALIDATION, "true");
codegen.additionalProperties().put(SpringCodegen.PERFORM_BEANVALIDATION, "true");
codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.model");
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.controller");
ClientOptInput input = new ClientOptInput()
.openAPI(openAPI)
.config(codegen);
DefaultGenerator generator = new DefaultGenerator();
Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));
JavaFileAssert.assertThat(files.get("ResponseTest.java"))
.isNormalClass()
.hasImports("javax.validation.Valid")
.hasProperty("details")
.withType( "Map<String, Object>" )
.toType()
.hasProperty("response")
.withType( "JsonNullable<Set<ResponseTest2>>" )
.toType()
.hasProperty("nullableDtos")
.withType( "JsonNullable<Set<@Valid ResponseTest2>>" )
.toType()
.hasProperty("dtos")
.withType( "Set<@Valid ResponseTest2>" )
.toType()
.hasProperty("listNullableDtos")
.withType( "JsonNullable<List<@Valid ResponseTest2>>" )
.toType()
.hasProperty("listDtos")
.withType( "List<@Valid ResponseTest2>" )
.toType()
.hasProperty("nullableStrings")
.withType( "JsonNullable<Set<String>>" )
.toType()
.hasProperty("strings")
.withType( "Set<String>" )
.toType()
.hasProperty("nullableInts")
.withType( "JsonNullable<Set<Integer>>" )
.toType()
.hasProperty("ints")
.withType( "Set<Integer>" );
}
// Helper function, intended to reduce boilerplate
private Map<String, File> generateFiles(SpringCodegen codegen, String filePath) throws IOException {
final File output = Files.createTempDirectory("test").toFile().getCanonicalFile();

View File

@@ -451,11 +451,6 @@ components:
type: array
items:
type: string
array_string_extension_nullable:
x-nullable: true
type: array
items:
type: string
string_nullable:
type: string
nullable: true

View File

@@ -1417,7 +1417,6 @@ components:
type: string
example: doggie
photoUrls:
minItems: 0
type: array
xml:
name: photoUrl
@@ -1985,19 +1984,6 @@ components:
enum:
- admin
- user
AllOfWithNestedOneOf:
type: object
title: allOf with nested oneOf model (inline)
allOf:
- $ref: '#/components/schemas/Tag'
- type: object
properties:
inner_name:
type: string
nested_oneof:
oneOf:
- $ref: '#/components/schemas/BasquePig'
- $ref: '#/components/schemas/DanishPig'
Pig:
oneOf:
- $ref: '#/components/schemas/BasquePig'

View File

@@ -1,43 +0,0 @@
openapi: 3.0.1
info:
version: 1.0.0
title: Example
license:
name: MIT
servers:
- url: http://api.example.xyz/v1
paths:
/person/display/{personId}:
get:
parameters:
- name: personId
in: path
required: true
description: The id of the person to retrieve
schema:
type: string
operationId: list
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/BooleanEnumTest"
components:
schemas:
BooleanEnumTest:
description: a model to with boolean enum property
type: object
properties:
id:
type: integer
format: int64
name:
type: string
pattern: '^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$'
boolean_enum:
type: boolean
enum:
- true
- false

View File

@@ -1,45 +0,0 @@
openapi: 3.0.1
info:
version: 1.0.0
title: Example
license:
name: MIT
servers:
- url: http://api.example.xyz/v1
paths:
/person/display/{personId}:
get:
parameters:
- name: personId
in: path
required: true
description: The id of the person to retrieve
schema:
type: string
operationId: list
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/AnyOfTest"
components:
schemas:
AnyOfTest:
description: to test anyOf
anyOf:
- type: string
- type: null
OneOfTest:
description: to test oneOf
oneOf:
- type: integer
- $ref: null
OneOfNullableTest:
description: to test oneOf nullable
oneOf:
- type: integer
- type: string
- $ref: null

View File

@@ -1,101 +0,0 @@
openapi: 3.0.1
info:
title: test
version: 1.0.0
paths:
/test:
get:
summary: test
operationId: test
responses:
200:
$ref: '#/components/responses/ResponseTest'
components:
responses:
ResponseTest:
description: ""
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseTest'
schemas:
ResponseTest:
type: object
properties:
details:
type: object
additionalProperties:
type: object
description: An object with key/value pairs containing additional information about the error.
response:
type: array
description: dtos
uniqueItems: true
items:
$ref: '#/components/schemas/ResponseTest2'
maxItems: 10
nullable: true
nullableDtos:
type: array
description: dtos
uniqueItems: true
items:
$ref: '#/components/schemas/ResponseTest2'
maxItems: 10
nullable: true
dtos:
type: array
description: dtos
uniqueItems: true
items:
$ref: '#/components/schemas/ResponseTest2'
maxItems: 10
listNullableDtos:
type: array
description: dtos
items:
$ref: '#/components/schemas/ResponseTest2'
maxItems: 10
nullable: true
listDtos:
type: array
description: dtos
items:
$ref: '#/components/schemas/ResponseTest2'
maxItems: 10
nullableStrings:
type: array
description: dtos
uniqueItems: true
items:
type: string
maxItems: 10
nullable: true
strings:
type: array
description: dtos
uniqueItems: true
items:
type: string
maxItems: 10
nullableInts:
type: array
description: dtos
uniqueItems: true
items:
type: int
maxItems: 10
nullable: true
ints:
type: array
description: dtos
uniqueItems: true
items:
type: int
maxItems: 10
ResponseTest2:
type: object
properties:
label:
type: string
nullable: false

View File

@@ -12,7 +12,7 @@
<packaging>pom</packaging>
<name>openapi-generator-project</name>
<!-- RELEASE_VERSION -->
<version>6.5.0-SNAPSHOT</version>
<version>6.4.0</version>
<!-- /RELEASE_VERSION -->
<url>https://github.com/openapitools/openapi-generator</url>
<scm>

View File

@@ -466,11 +466,6 @@ components:
type: string
nullable: true
type: array
array_string_extension_nullable:
items:
type: string
type: array
x-nullable: true
string_nullable:
nullable: true
type: string

View File

@@ -116,7 +116,7 @@ ext {
swagger_annotations_version = "1.6.6"
jackson_version = "2.14.1"
jackson_databind_version = "2.14.1"
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
jakarta_annotation_version = "1.3.5"
httpclient_version = "5.1.3"
jodatime_version = "2.9.9"

View File

@@ -14,7 +14,6 @@ to test the default value of properties
|**arrayIntegerDefault** | **List&lt;Integer&gt;** | | [optional] |
|**arrayString** | **List&lt;String&gt;** | | [optional] |
|**arrayStringNullable** | **List&lt;String&gt;** | | [optional] |
|**arrayStringExtensionNullable** | **List&lt;String&gt;** | | [optional] |
|**stringNullable** | **String** | | [optional] |

View File

@@ -273,7 +273,7 @@
<httpclient-version>5.1.3</httpclient-version>
<jackson-version>2.14.1</jackson-version>
<jackson-databind-version>2.14.1</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.2</junit-version>
</properties>

View File

@@ -43,7 +43,6 @@ import java.util.StringJoiner;
DefaultValue.JSON_PROPERTY_ARRAY_INTEGER_DEFAULT,
DefaultValue.JSON_PROPERTY_ARRAY_STRING,
DefaultValue.JSON_PROPERTY_ARRAY_STRING_NULLABLE,
DefaultValue.JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE,
DefaultValue.JSON_PROPERTY_STRING_NULLABLE
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@@ -103,9 +102,6 @@ public class DefaultValue {
public static final String JSON_PROPERTY_ARRAY_STRING_NULLABLE = "array_string_nullable";
private JsonNullable<List<String>> arrayStringNullable = JsonNullable.<List<String>>undefined();
public static final String JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE = "array_string_extension_nullable";
private JsonNullable<List<String>> arrayStringExtensionNullable = JsonNullable.<List<String>>undefined();
public static final String JSON_PROPERTY_STRING_NULLABLE = "string_nullable";
private JsonNullable<String> stringNullable = JsonNullable.<String>undefined();
@@ -328,52 +324,6 @@ public class DefaultValue {
}
public DefaultValue arrayStringExtensionNullable(List<String> arrayStringExtensionNullable) {
this.arrayStringExtensionNullable = JsonNullable.<List<String>>of(arrayStringExtensionNullable);
return this;
}
public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) {
if (this.arrayStringExtensionNullable == null || !this.arrayStringExtensionNullable.isPresent()) {
this.arrayStringExtensionNullable = JsonNullable.<List<String>>of(new ArrayList<>());
}
try {
this.arrayStringExtensionNullable.get().add(arrayStringExtensionNullableItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
return this;
}
/**
* Get arrayStringExtensionNullable
* @return arrayStringExtensionNullable
**/
@javax.annotation.Nullable
@JsonIgnore
public List<String> getArrayStringExtensionNullable() {
return arrayStringExtensionNullable.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<List<String>> getArrayStringExtensionNullable_JsonNullable() {
return arrayStringExtensionNullable;
}
@JsonProperty(JSON_PROPERTY_ARRAY_STRING_EXTENSION_NULLABLE)
public void setArrayStringExtensionNullable_JsonNullable(JsonNullable<List<String>> arrayStringExtensionNullable) {
this.arrayStringExtensionNullable = arrayStringExtensionNullable;
}
public void setArrayStringExtensionNullable(List<String> arrayStringExtensionNullable) {
this.arrayStringExtensionNullable = JsonNullable.<List<String>>of(arrayStringExtensionNullable);
}
public DefaultValue stringNullable(String stringNullable) {
this.stringNullable = JsonNullable.<String>of(stringNullable);
@@ -423,7 +373,6 @@ public class DefaultValue {
Objects.equals(this.arrayIntegerDefault, defaultValue.arrayIntegerDefault) &&
Objects.equals(this.arrayString, defaultValue.arrayString) &&
equalsNullable(this.arrayStringNullable, defaultValue.arrayStringNullable) &&
equalsNullable(this.arrayStringExtensionNullable, defaultValue.arrayStringExtensionNullable) &&
equalsNullable(this.stringNullable, defaultValue.stringNullable);
}
@@ -433,7 +382,7 @@ public class DefaultValue {
@Override
public int hashCode() {
return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, hashCodeNullable(arrayStringNullable), hashCodeNullable(arrayStringExtensionNullable), hashCodeNullable(stringNullable));
return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, hashCodeNullable(arrayStringNullable), hashCodeNullable(stringNullable));
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@@ -453,7 +402,6 @@ public class DefaultValue {
sb.append(" arrayIntegerDefault: ").append(toIndentedString(arrayIntegerDefault)).append("\n");
sb.append(" arrayString: ").append(toIndentedString(arrayString)).append("\n");
sb.append(" arrayStringNullable: ").append(toIndentedString(arrayStringNullable)).append("\n");
sb.append(" arrayStringExtensionNullable: ").append(toIndentedString(arrayStringExtensionNullable)).append("\n");
sb.append(" stringNullable: ").append(toIndentedString(stringNullable)).append("\n");
sb.append("}");
return sb.toString();
@@ -588,20 +536,6 @@ public class DefaultValue {
}
}
// add `array_string_extension_nullable` to the URL query string
if (getArrayStringExtensionNullable() != null) {
for (int i = 0; i < getArrayStringExtensionNullable().size(); i++) {
try {
joiner.add(String.format("%sarray_string_extension_nullable%s%s=%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
URLEncoder.encode(String.valueOf(getArrayStringExtensionNullable().get(i)), "UTF-8").replaceAll("\\+", "%20")));
} catch (UnsupportedEncodingException e) {
// Should never happen, UTF-8 is always supported
throw new RuntimeException(e);
}
}
}
// add `string_nullable` to the URL query string
if (getStringNullable() != null) {
try {

View File

@@ -220,7 +220,7 @@ public class CustomTest {
Assert.assertNull(d.getArrayStringNullable());
Assert.assertEquals(d.getArrayString().size(), 0);
Assert.assertEquals(apiClient.getObjectMapper().writeValueAsString(d), "{\"array_string_enum_ref_default\":[\"success\",\"failure\"],\"array_string_enum_default\":[\"success\",\"failure\"],\"array_string_default\":[\"failure\",\"skipped\"],\"array_integer_default\":[1,3],\"array_string\":[],\"array_string_nullable\":{\"present\":false},\"array_string_extension_nullable\":{\"present\":false},\"string_nullable\":{\"present\":false}}");
Assert.assertEquals(apiClient.getObjectMapper().writeValueAsString(d), "{\"array_string_enum_ref_default\":[\"success\",\"failure\"],\"array_string_enum_default\":[\"success\",\"failure\"],\"array_string_default\":[\"failure\",\"skipped\"],\"array_integer_default\":[1,3],\"array_string\":[],\"array_string_nullable\":{\"present\":false},\"string_nullable\":{\"present\":false}}");
}
@Test
@@ -248,7 +248,7 @@ public class CustomTest {
Assert.assertNull(d.getArrayStringNullable());
Assert.assertEquals(d.getArrayString().size(), 0);
Assert.assertEquals(apiClient.getObjectMapper().writeValueAsString(d), "{\"array_string_enum_ref_default\":[\"unclassified\"],\"array_string_enum_default\":[\"unclassified\"],\"array_string_default\":[\"failure\"],\"array_integer_default\":[1,3],\"array_string\":[],\"array_string_nullable\":{\"present\":false},\"array_string_extension_nullable\":{\"present\":false},\"string_nullable\":{\"present\":false}}");
Assert.assertEquals(apiClient.getObjectMapper().writeValueAsString(d), "{\"array_string_enum_ref_default\":[\"unclassified\"],\"array_string_enum_default\":[\"unclassified\"],\"array_string_default\":[\"failure\"],\"array_integer_default\":[1,3],\"array_string\":[],\"array_string_nullable\":{\"present\":false},\"string_nullable\":{\"present\":false}}");
}
@Test

View File

@@ -1 +1 @@
6.5.0-SNAPSHOT
6.4.0

View File

@@ -466,11 +466,6 @@ components:
type: string
nullable: true
type: array
array_string_extension_nullable:
items:
type: string
type: array
x-nullable: true
string_nullable:
nullable: true
type: string

View File

@@ -104,7 +104,7 @@ ext {
swagger_annotations_version = "1.5.24"
jackson_version = "2.13.4"
jackson_databind_version = "2.13.4.2"
jackson_databind_nullable_version = "0.2.6"
jackson_databind_nullable_version = "0.2.4"
jakarta_annotation_version = "1.3.5"
feign_version = "10.11"
feign_form_version = "3.8.0"

View File

@@ -310,7 +310,7 @@
<feign-version>10.11</feign-version>
<feign-form-version>3.8.0</feign-form-version>
<gson-version>2.8.6</gson-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
<jackson-databind-version>2.13.4.2</jackson-databind-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>5.7.0</junit-version>

View File

@@ -104,10 +104,6 @@ public class DefaultValue {
@SerializedName(SERIALIZED_NAME_ARRAY_STRING_NULLABLE)
private List<String> arrayStringNullable;
public static final String SERIALIZED_NAME_ARRAY_STRING_EXTENSION_NULLABLE = "array_string_extension_nullable";
@SerializedName(SERIALIZED_NAME_ARRAY_STRING_EXTENSION_NULLABLE)
private List<String> arrayStringExtensionNullable;
public static final String SERIALIZED_NAME_STRING_NULLABLE = "string_nullable";
@SerializedName(SERIALIZED_NAME_STRING_NULLABLE)
private String stringNullable;
@@ -292,33 +288,6 @@ public class DefaultValue {
}
public DefaultValue arrayStringExtensionNullable(List<String> arrayStringExtensionNullable) {
this.arrayStringExtensionNullable = arrayStringExtensionNullable;
return this;
}
public DefaultValue addArrayStringExtensionNullableItem(String arrayStringExtensionNullableItem) {
this.arrayStringExtensionNullable.add(arrayStringExtensionNullableItem);
return this;
}
/**
* Get arrayStringExtensionNullable
* @return arrayStringExtensionNullable
**/
@javax.annotation.Nullable
public List<String> getArrayStringExtensionNullable() {
return arrayStringExtensionNullable;
}
public void setArrayStringExtensionNullable(List<String> arrayStringExtensionNullable) {
this.arrayStringExtensionNullable = arrayStringExtensionNullable;
}
public DefaultValue stringNullable(String stringNullable) {
this.stringNullable = stringNullable;
@@ -356,7 +325,6 @@ public class DefaultValue {
Objects.equals(this.arrayIntegerDefault, defaultValue.arrayIntegerDefault) &&
Objects.equals(this.arrayString, defaultValue.arrayString) &&
Objects.equals(this.arrayStringNullable, defaultValue.arrayStringNullable) &&
Objects.equals(this.arrayStringExtensionNullable, defaultValue.arrayStringExtensionNullable) &&
Objects.equals(this.stringNullable, defaultValue.stringNullable);
}
@@ -366,7 +334,7 @@ public class DefaultValue {
@Override
public int hashCode() {
return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, arrayStringNullable, arrayStringExtensionNullable, stringNullable);
return Objects.hash(arrayStringEnumRefDefault, arrayStringEnumDefault, arrayStringDefault, arrayIntegerDefault, arrayString, arrayStringNullable, stringNullable);
}
private static <T> int hashCodeNullable(JsonNullable<T> a) {
@@ -386,7 +354,6 @@ public class DefaultValue {
sb.append(" arrayIntegerDefault: ").append(toIndentedString(arrayIntegerDefault)).append("\n");
sb.append(" arrayString: ").append(toIndentedString(arrayString)).append("\n");
sb.append(" arrayStringNullable: ").append(toIndentedString(arrayStringNullable)).append("\n");
sb.append(" arrayStringExtensionNullable: ").append(toIndentedString(arrayStringExtensionNullable)).append("\n");
sb.append(" stringNullable: ").append(toIndentedString(stringNullable)).append("\n");
sb.append("}");
return sb.toString();

View File

@@ -1 +1 @@
6.5.0-SNAPSHOT
6.4.0

View File

@@ -466,11 +466,6 @@ components:
type: string
nullable: true
type: array
array_string_extension_nullable:
items:
type: string
type: array
x-nullable: true
string_nullable:
nullable: true
type: string

View File

@@ -14,7 +14,6 @@ to test the default value of properties
|**arrayIntegerDefault** | **List&lt;Integer&gt;** | | [optional] |
|**arrayString** | **List&lt;String&gt;** | | [optional] |
|**arrayStringNullable** | **List&lt;String&gt;** | | [optional] |
|**arrayStringExtensionNullable** | **List&lt;String&gt;** | | [optional] |
|**stringNullable** | **String** | | [optional] |

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