diff --git a/.circleci/config.yml b/.circleci/config.yml index b1c5957943e..b610ceeb2bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,24 +42,6 @@ jobs: command: |- printf '127.0.0.1 petstore.swagger.io ' | sudo tee -a /etc/hosts - # Dependencies - # Install latest stable node for angular 6 - - run: - name: Install node@stable (for angular 6) - command: | - set +e - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash - export NVM_DIR="/opt/circleci/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - #nvm install stable - # install v16 instead of the latest stable version - nvm install 16 - nvm alias default 16 - - # Each step uses the same `$BASH_ENV`, so need to modify it - echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV - echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV - - run: node --version # - run: docker pull openapitools/openapi-petstore # - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore - run: docker pull swaggerapi/petstore diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 6e231909d61..697009699a3 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -40,6 +40,13 @@ elif [ "$NODE_INDEX" = "2" ]; then sudo apt-get -y build-dep libcurl4-gnutls-dev sudo apt-get -y install libcurl4-gnutls-dev + # Install golang version 1.14 + go version + sudo mkdir /usr/local/go1.14 + wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14 + export PATH="/usr/local/go1.14/go/bin:$PATH" + go version + # run integration tests mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error elif [ "$NODE_INDEX" = "3" ]; then @@ -55,6 +62,21 @@ elif [ "$NODE_INDEX" = "3" ]; then pyenv global 3.6.3 python3 --version + # Install node@stable (for angular 6) + set +e + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash + export NVM_DIR="/opt/circleci/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + #nvm install stable + # install v16 instead of the latest stable version + nvm install 16 + nvm alias default 16 + node --version + + # Each step uses the same `$BASH_ENV`, so need to modify it + echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV + echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV + mvn --no-snapshot-updates --quiet verify -Psamples.circleci.node3 -Dorg.slf4j.simpleLogger.defaultLogLevel=error else @@ -62,13 +84,6 @@ else #sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 java -version - # Install golang version 1.14 - go version - sudo mkdir /usr/local/go1.14 - wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14 - export PATH="/usr/local/go1.14/go/bin:$PATH" - go version - mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error fi diff --git a/README.md b/README.md index 397802a8bdd..e993fdf0fb2 100644 --- a/README.md +++ b/README.md @@ -833,6 +833,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2021-05-31 - [FlutterでOpen Api Generator(Swagger)を使う](https://aakira.app/blog/2021/05/flutter-open-api/) by [AAkira](https://twitter.com/_a_akira) - 2021-06-22 - [Rest API Documentation and Client Generation With OpenAPI](https://dzone.com/articles/rest-api-documentation-and-client-generation-with) by [Prasanth Gullapalli](https://dzone.com/users/1011797/prasanthnath.g@gmail.com.html) - 2021-07-16 - [銀行事業のサーバーサイド開発について / LINE 京都開発室 エンジニア採用説明会](https://www.youtube.com/watch?v=YrrKQHxLPpQ) by 野田誠人, Robert Mitchell +- 2021-07-19 - [OpenAPI code generation with kotlin](https://sylhare.github.io/2021/07/19/Openapi-swagger-codegen-with-kotlin.html) by [sylhare](https://github.com/sylhare) - 2021-07-29 - [How To Rewrite a Huge Codebase](https://dzone.com/articles/how-to-rewrite-a-huge-code-base) by [Curtis Poe](https://dzone.com/users/4565446/publiusovidius.html) - 2021-08-21 - [Generating Client APIs using Swagger Part 1](https://medium.com/@flowsquad/generating-client-apis-using-swagger-part-1-2d46f13f5e92) by [FlowSquad.io](https://medium.com/@flowsquad) - 2021-09-11 - [Invoking AWS ParallelCluster API](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) at [AWS ParallelCluster API official documentation](https://docs.aws.amazon.com/parallelcluster/latest/ug/api-reference-v3.html) diff --git a/bin/configs/cpp-restsdk-client.yaml b/bin/configs/cpp-restsdk-client.yaml index 87bce881bbd..fedc628a69e 100644 --- a/bin/configs/cpp-restsdk-client.yaml +++ b/bin/configs/cpp-restsdk-client.yaml @@ -2,3 +2,5 @@ generatorName: cpp-restsdk outputDir: samples/client/petstore/cpp-restsdk/client inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/cpp-rest-sdk-client +additionalProperties: + packageName: CppRestPetstoreClient diff --git a/bin/configs/java-microprofile-rest-client.yaml b/bin/configs/java-microprofile-rest-client.yaml index 2d9796db540..384a6aa7f30 100644 --- a/bin/configs/java-microprofile-rest-client.yaml +++ b/bin/configs/java-microprofile-rest-client.yaml @@ -5,3 +5,4 @@ inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/Java additionalProperties: artifactId: microprofile-rest-client + configKey: petstore diff --git a/docs/generators/cpp-restsdk.md b/docs/generators/cpp-restsdk.md index 9dfbb390514..4fc97b939ae 100644 --- a/docs/generators/cpp-restsdk.md +++ b/docs/generators/cpp-restsdk.md @@ -12,6 +12,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |defaultInclude|The default include statement that should be placed in all headers for including things like the declspec (convention: #include "Commons.h" | || |generateGMocksForApis|Generate Google Mock classes for APIs.| |null| |modelPackage|C++ namespace for models (convention: name.space.model).| |org.openapitools.client.model| +|packageName|C++ package (library) name.| |CppRestOpenAPIClient| |packageVersion|C++ package version.| |1.0.0| |reservedWordPrefix|Prefix to prepend to reserved words in order to avoid conflicts| |r_| |variableNameFirstCharacterUppercase|Make first character of variable name uppercase (eg. value -> Value)| |true| diff --git a/docs/generators/java.md b/docs/generators/java.md index 0cb76c15409..8b360b4b427 100644 --- a/docs/generators/java.md +++ b/docs/generators/java.md @@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| |caseInsensitiveResponseHeaders|Make API response's headers case-insensitive. Available on okhttp-gson, jersey2 libraries| |false| +|configKey|Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.| |null| |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date (if you really have a good reason not to use threetenbp
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true
**threetenbp**
Backport of JSR310 (preferred for jdk < 1.8)
|threetenbp| |developerEmail|developer email in generated pom.xml| |team@openapitools.org| |developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java new file mode 100644 index 00000000000..f801853dafc --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenComposedSchemas.java @@ -0,0 +1,66 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen; + +import java.util.*; + +public class CodegenComposedSchemas { + private List allOf; + private List oneOf; + private List anyOf; + + public CodegenComposedSchemas(List allOf, List oneOf, List anyOf) { + this.allOf = allOf; + this.oneOf = oneOf; + this.anyOf = anyOf; + } + + public List getAllOf() { + return allOf; + } + + public List getOneOf() { + return oneOf; + } + + public List getAnyOf() { + return anyOf; + } + + public String toString() { + final StringBuilder sb = new StringBuilder("CodegenComposedSchemas{"); + sb.append("oneOf=").append(oneOf); + sb.append(", anyOf=").append(anyOf); + sb.append(", allOf=").append(allOf); + sb.append('}'); + return sb.toString(); + } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodegenComposedSchemas that = (CodegenComposedSchemas) o; + return Objects.equals(oneOf, that.oneOf) && + Objects.equals(anyOf, that.anyOf) && + Objects.equals(allOf, that.allOf); + } + + @Override + public int hashCode() { + return Objects.hash(oneOf, anyOf, allOf); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java index ab9f23fba67..0a44812ceac 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java @@ -49,11 +49,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties { public Set oneOf = new TreeSet(); public Set allOf = new TreeSet(); - // anyOf, oneOf, allOf with full properties/tags (e.g. isString, etc) - public List anyOfProps = new ArrayList<>(); - public List allOfProps = new ArrayList<>(); - public List oneOfProps = new ArrayList<>(); - // The schema name as written in the OpenAPI document. public String name; // The language-specific name of the class that implements this schema. @@ -110,6 +105,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties { public ExternalDocumentation externalDocumentation; public Map vendorExtensions = new HashMap(); + private CodegenComposedSchemas composedSchemas; + private boolean hasMultipleTypes = false; /** * The type of the value for the additionalProperties keyword in the OAS document. @@ -810,6 +807,22 @@ public class CodegenModel implements IJsonSchemaValidationProperties { this.isAnyType = isAnyType; } + @Override + public void setComposedSchemas(CodegenComposedSchemas composedSchemas) { + this.composedSchemas = composedSchemas; + } + + @Override + public CodegenComposedSchemas getComposedSchemas() { + return composedSchemas; + } + + @Override + public boolean getHasMultipleTypes() {return hasMultipleTypes; } + + @Override + public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -843,12 +856,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties { hasOnlyReadOnly == that.hasOnlyReadOnly && isNull == that.isNull && hasValidation == that.hasValidation && + hasMultipleTypes == that.getHasMultipleTypes() && hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() && getIsAnyType() == that.getIsAnyType() && getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() && getUniqueItems() == that.getUniqueItems() && getExclusiveMinimum() == that.getExclusiveMinimum() && getExclusiveMaximum() == that.getExclusiveMaximum() && + Objects.equals(composedSchemas, that.composedSchemas) && Objects.equals(parent, that.parent) && Objects.equals(parentSchema, that.parentSchema) && Objects.equals(interfaces, that.interfaces) && @@ -856,9 +871,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties { Objects.equals(parentModel, that.parentModel) && Objects.equals(interfaceModels, that.interfaceModels) && Objects.equals(children, that.children) && - Objects.equals(anyOf, that.anyOfProps) && - Objects.equals(oneOf, that.oneOfProps) && - Objects.equals(allOf, that.allOfProps) && Objects.equals(anyOf, that.anyOf) && Objects.equals(oneOf, that.oneOf) && Objects.equals(allOf, that.allOf) && @@ -921,8 +933,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties { getAdditionalPropertiesType(), getMaxProperties(), getMinProperties(), getUniqueItems(), getMaxItems(), getMinItems(), getMaxLength(), getMinLength(), getExclusiveMinimum(), getExclusiveMaximum(), getMinimum(), getMaximum(), getPattern(), getMultipleOf(), getItems(), getAdditionalProperties(), getIsModel(), - getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, anyOfProps, oneOfProps, allOfProps, - isAnyType); + getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping, + isAnyType, getComposedSchemas(), hasMultipleTypes); } @Override @@ -938,9 +950,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties { sb.append(", anyOf=").append(anyOf); sb.append(", oneOf=").append(oneOf); sb.append(", allOf=").append(allOf); - sb.append(", anyOf=").append(anyOfProps); - sb.append(", oneOf=").append(oneOfProps); - sb.append(", allOf=").append(allOfProps); sb.append(", name='").append(name).append('\''); sb.append(", classname='").append(classname).append('\''); sb.append(", title='").append(title).append('\''); @@ -1017,6 +1026,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties { sb.append(", getAdditionalPropertiesIsAnyType=").append(getAdditionalPropertiesIsAnyType()); sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping); sb.append(", getIsAnyType=").append(getIsAnyType()); + sb.append(", composedSchemas=").append(composedSchemas); + sb.append(", hasMultipleTypes=").append(hasMultipleTypes); sb.append('}'); return sb.toString(); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java index ebd01afdfd2..38eb785410e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java @@ -107,6 +107,8 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { public boolean isNull; private boolean hasRequired; private boolean hasDiscriminatorWithNonEmptyMapping; + private CodegenComposedSchemas composedSchemas; + private boolean hasMultipleTypes = false; public CodegenParameter copy() { CodegenParameter output = new CodegenParameter(); @@ -158,7 +160,11 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { output.setHasVars(this.hasVars); output.setHasRequired(this.hasRequired); output.setHasDiscriminatorWithNonEmptyMapping(this.hasDiscriminatorWithNonEmptyMapping); + output.setHasMultipleTypes(this.hasMultipleTypes); + if (this.composedSchemas != null) { + output.setComposedSchemas(this.getComposedSchemas()); + } if (this._enum != null) { output._enum = new ArrayList(this._enum); } @@ -216,7 +222,7 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { @Override public int hashCode() { - return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping); + return Objects.hash(isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, isContainer, isCollectionFormatMulti, isPrimitiveType, isModel, isExplode, baseName, paramName, dataType, datatypeWithEnum, dataFormat, collectionFormat, description, unescapedDescription, baseType, defaultValue, enumName, style, isDeepObject, isAllowEmptyValue, example, jsonSchema, isString, isNumeric, isInteger, isLong, isNumber, isFloat, isDouble, isDecimal, isByteArray, isBinary, isBoolean, isDate, isDateTime, isUuid, isUri, isEmail, isFreeFormObject, isAnyType, isArray, isMap, isFile, isEnum, _enum, allowableValues, items, mostInnerItems, additionalProperties, vars, requiredVars, vendorExtensions, hasValidation, getMaxProperties(), getMinProperties(), isNullable, isDeprecated, required, getMaximum(), getExclusiveMaximum(), getMinimum(), getExclusiveMinimum(), getMaxLength(), getMinLength(), getPattern(), getMaxItems(), getMinItems(), getUniqueItems(), contentType, multipleOf, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, isShort, isUnboundedInteger, hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes); } @Override @@ -264,13 +270,15 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { isDeprecated == that.isDeprecated && required == that.required && isNull == that.isNull && - hasDiscriminatorWithNonEmptyMapping && that.getHasDiscriminatorWithNonEmptyMapping() && + hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() && getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() && + hasMultipleTypes == that.getHasMultipleTypes() && getHasVars() == that.getHasVars() && getHasRequired() == that.getHasRequired() && getExclusiveMaximum() == that.getExclusiveMaximum() && getExclusiveMinimum() == that.getExclusiveMinimum() && getUniqueItems() == that.getUniqueItems() && + Objects.equals(composedSchemas, that.getComposedSchemas()) && Objects.equals(baseName, that.baseName) && Objects.equals(paramName, that.paramName) && Objects.equals(dataType, that.dataType) && @@ -393,6 +401,8 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { sb.append(", getHasVars=").append(hasVars); sb.append(", getHasRequired=").append(hasRequired); sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping); + sb.append(", composedSchemas=").append(composedSchemas); + sb.append(", hasMultipleTypes=").append(hasMultipleTypes); sb.append('}'); return sb.toString(); } @@ -706,5 +716,21 @@ public class CodegenParameter implements IJsonSchemaValidationProperties { public void setIsAnyType(boolean isAnyType) { this.isAnyType = isAnyType; } + + @Override + public void setComposedSchemas(CodegenComposedSchemas composedSchemas) { + this.composedSchemas = composedSchemas; + } + + @Override + public CodegenComposedSchemas getComposedSchemas() { + return composedSchemas; + } + + @Override + public boolean getHasMultipleTypes() {return hasMultipleTypes; } + + @Override + public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java index ed1636fc6d5..c7a22915dbf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java @@ -191,6 +191,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti private boolean hasVars; private boolean hasRequired; private boolean hasDiscriminatorWithNonEmptyMapping; + private CodegenComposedSchemas composedSchemas = null; + private boolean hasMultipleTypes = false; public String getBaseName() { return baseName; @@ -614,6 +616,16 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti this.xmlNamespace = xmlNamespace; } + @Override + public void setComposedSchemas(CodegenComposedSchemas composedSchemas) { + this.composedSchemas = composedSchemas; + } + + @Override + public CodegenComposedSchemas getComposedSchemas() { + return composedSchemas; + } + @Override public CodegenProperty clone() { try { @@ -642,6 +654,9 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti if (this.vendorExtensions != null) { cp.vendorExtensions = new HashMap(this.vendorExtensions); } + if (this.composedSchemas != null) { + cp.composedSchemas = this.composedSchemas; + } return cp; } catch (CloneNotSupportedException e) { @@ -787,6 +802,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti this.isAnyType = isAnyType; } + @Override + public boolean getHasMultipleTypes() {return hasMultipleTypes; } + + @Override + public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; } + @Override public String toString() { final StringBuilder sb = new StringBuilder("CodegenProperty{"); @@ -882,6 +903,8 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti sb.append(", getHasVars=").append(getHasVars()); sb.append(", getHasRequired=").append(getHasRequired()); sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping); + sb.append(", composedSchemas=").append(composedSchemas); + sb.append(", hasMultipleTypes=").append(hasMultipleTypes); sb.append('}'); return sb.toString(); } @@ -933,10 +956,12 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti isXmlAttribute == that.isXmlAttribute && isXmlWrapped == that.isXmlWrapped && isNull == that.isNull && + hasMultipleTypes == that.getHasMultipleTypes() && hasDiscriminatorWithNonEmptyMapping == that.hasDiscriminatorWithNonEmptyMapping && getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() && getHasVars() == that.getHasVars() && getHasRequired() ==that.getHasRequired() && + Objects.equals(composedSchemas, that.composedSchemas) && Objects.equals(openApiType, that.openApiType) && Objects.equals(baseName, that.baseName) && Objects.equals(complexType, that.complexType) && @@ -999,6 +1024,6 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti vendorExtensions, hasValidation, isInherited, discriminatorValue, nameInCamelCase, nameInSnakeCase, enumName, maxItems, minItems, isXmlAttribute, xmlPrefix, xmlName, xmlNamespace, isXmlWrapped, isNull, additionalPropertiesIsAnyType, hasVars, hasRequired, - hasDiscriminatorWithNonEmptyMapping); + hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java index 1a99e774e59..b81bda5f583 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java @@ -85,6 +85,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { private boolean hasVars; private boolean hasRequired; private boolean hasDiscriminatorWithNonEmptyMapping; + private CodegenComposedSchemas composedSchemas; + private boolean hasMultipleTypes = false; @Override public int hashCode() { @@ -96,7 +98,7 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { getMaxProperties(), getMinProperties(), uniqueItems, getMaxItems(), getMinItems(), getMaxLength(), getMinLength(), exclusiveMinimum, exclusiveMaximum, getMinimum(), getMaximum(), getPattern(), is1xx, is2xx, is3xx, is4xx, is5xx, additionalPropertiesIsAnyType, hasVars, hasRequired, - hasDiscriminatorWithNonEmptyMapping); + hasDiscriminatorWithNonEmptyMapping, composedSchemas, hasMultipleTypes); } @Override @@ -141,9 +143,11 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { is4xx == that.is4xx && is5xx == that.is5xx && hasDiscriminatorWithNonEmptyMapping == that.getHasDiscriminatorWithNonEmptyMapping() && + hasMultipleTypes == that.getHasMultipleTypes() && getAdditionalPropertiesIsAnyType() == that.getAdditionalPropertiesIsAnyType() && getHasVars() == that.getHasVars() && getHasRequired() == that.getHasRequired() && + Objects.equals(composedSchemas, that.getComposedSchemas()) && Objects.equals(vars, that.vars) && Objects.equals(requiredVars, that.requiredVars) && Objects.equals(headers, that.headers) && @@ -482,6 +486,8 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { sb.append(", getHasVars=").append(hasVars); sb.append(", getHasRequired=").append(hasRequired); sb.append(", getHasDiscriminatorWithNonEmptyMapping=").append(hasDiscriminatorWithNonEmptyMapping); + sb.append(", composedSchemas=").append(composedSchemas); + sb.append(", hasMultipleTypes=").append(hasMultipleTypes); sb.append('}'); return sb.toString(); } @@ -570,4 +576,20 @@ public class CodegenResponse implements IJsonSchemaValidationProperties { public void setIsAnyType(boolean isAnyType) { this.isAnyType = isAnyType; } + + @Override + public void setComposedSchemas(CodegenComposedSchemas composedSchemas) { + this.composedSchemas = composedSchemas; + } + + @Override + public CodegenComposedSchemas getComposedSchemas() { + return composedSchemas; + } + + @Override + public boolean getHasMultipleTypes() {return hasMultipleTypes; } + + @Override + public void setHasMultipleTypes(boolean hasMultipleTypes) { this.hasMultipleTypes = hasMultipleTypes; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index d5920a2abc7..2c530aeaffe 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -2440,9 +2440,6 @@ public class DefaultCodegen implements CodegenConfig { // interfaces (schemas defined in allOf, anyOf, oneOf) List interfaces = ModelUtils.getInterfaces(composed); - List anyOfProps = new ArrayList<>(); - List allOfProps = new ArrayList<>(); - List oneOfProps = new ArrayList<>(); if (!interfaces.isEmpty()) { // m.interfaces is for backward compatibility if (m.interfaces == null) @@ -2467,7 +2464,6 @@ public class DefaultCodegen implements CodegenConfig { LOGGER.warn("{} (anyOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); } else { m.anyOf.add(languageType); - anyOfProps.add(interfaceProperty); } } else if (composed.getOneOf() != null) { @@ -2475,7 +2471,6 @@ public class DefaultCodegen implements CodegenConfig { LOGGER.warn("{} (oneOf schema) already has `{}` defined and therefore it's skipped.", m.name, languageType); } else { m.oneOf.add(languageType); - oneOfProps.add(interfaceProperty); } } else if (composed.getAllOf() != null) { // no need to add primitive type to allOf, which should comprise of schemas (models) only @@ -2511,23 +2506,16 @@ public class DefaultCodegen implements CodegenConfig { if (composed.getAnyOf() != null) { m.anyOf.add(modelName); - anyOfProps.add(interfaceProperty); } else if (composed.getOneOf() != null) { m.oneOf.add(modelName); - oneOfProps.add(interfaceProperty); } else if (composed.getAllOf() != null) { m.allOf.add(modelName); - allOfProps.add(interfaceProperty); } else { LOGGER.error("Composed schema has incorrect anyOf, allOf, oneOf defined: {}", composed); } } } - m.oneOfProps = oneOfProps; - m.allOfProps = allOfProps; - m.anyOfProps = anyOfProps; - if (parent != null && composed.getAllOf() != null) { // set parent for allOf only m.parentSchema = parentName; m.parent = toModelName(parentName); @@ -2696,6 +2684,7 @@ public class DefaultCodegen implements CodegenConfig { } m.setTypeProperties(schema); + m.setComposedSchemas(getComposedSchemas(schema)); if (ModelUtils.isArraySchema(schema)) { CodegenProperty arrayProperty = fromProperty(name, schema); m.setItems(arrayProperty.items); @@ -3514,6 +3503,7 @@ public class DefaultCodegen implements CodegenConfig { } property.setTypeProperties(p); + property.setComposedSchemas(getComposedSchemas(p)); if (ModelUtils.isIntegerSchema(p)) { // integer type property.isNumeric = Boolean.TRUE; if (ModelUtils.isLongSchema(p)) { // int64/long format @@ -4265,6 +4255,7 @@ public class DefaultCodegen implements CodegenConfig { } r.setTypeProperties(responseSchema); + r.setComposedSchemas(getComposedSchemas(responseSchema)); if (ModelUtils.isArraySchema(responseSchema)) { r.simpleType = false; r.containerType = cp.containerType; @@ -4547,6 +4538,7 @@ public class DefaultCodegen implements CodegenConfig { } ModelUtils.syncValidationProperties(parameterSchema, codegenParameter); codegenParameter.setTypeProperties(parameterSchema); + codegenParameter.setComposedSchemas(getComposedSchemas(parameterSchema)); if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec codegenParameter.isNullable = true; @@ -6156,6 +6148,7 @@ public class DefaultCodegen implements CodegenConfig { Schema ps = unaliasSchema(propertySchema, importMapping); ModelUtils.syncValidationProperties(ps, codegenParameter); codegenParameter.setTypeProperties(ps); + codegenParameter.setComposedSchemas(getComposedSchemas(ps)); if (ps.getPattern() != null) { codegenParameter.pattern = toRegularExpression(ps.getPattern()); } @@ -6590,6 +6583,7 @@ public class DefaultCodegen implements CodegenConfig { ModelUtils.syncValidationProperties(unaliasedSchema, codegenParameter); codegenParameter.setTypeProperties(unaliasedSchema); + codegenParameter.setComposedSchemas(getComposedSchemas(unaliasedSchema)); // TODO in the future switch al the below schema usages to unaliasedSchema // because it keeps models as refs and will not get their referenced schemas if (ModelUtils.isArraySchema(schema)) { @@ -7154,4 +7148,30 @@ public class DefaultCodegen implements CodegenConfig { protected String getCollectionFormat(CodegenParameter codegenParameter) { return null; } + + private CodegenComposedSchemas getComposedSchemas(Schema schema) { + if (!(schema instanceof ComposedSchema)) { + return null; + } + ComposedSchema cs = (ComposedSchema) schema; + return new CodegenComposedSchemas( + getComposedProperties(cs.getAllOf(), "allOf"), + getComposedProperties(cs.getOneOf(), "oneOf"), + getComposedProperties(cs.getAnyOf(), "anyOf") + ); + } + + private List getComposedProperties(List xOfCollection, String collectionName) { + if (xOfCollection == null) { + return null; + } + List xOf = new ArrayList<>(); + int i = 0; + for (Schema xOfSchema: xOfCollection) { + CodegenProperty cp = fromProperty(collectionName + "_" + String.valueOf(i), xOfSchema); + xOf.add(cp); + i += 1; + } + return xOf; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java index b3833e47f6f..eb95821d6f3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java @@ -145,6 +145,14 @@ public interface IJsonSchemaValidationProperties { void setIsAnyType(boolean isAnyType); + CodegenComposedSchemas getComposedSchemas(); + + void setComposedSchemas(CodegenComposedSchemas composedSchemas); + + boolean getHasMultipleTypes(); + + void setHasMultipleTypes(boolean hasMultipleTypes); + /** * Syncs all the schema's type properties into the IJsonSchemaValidationProperties instance * for now this only supports types without format information diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index f6b62cdd144..a72388d4226 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -38,10 +38,13 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { public static final String DECLSPEC = "declspec"; public static final String DEFAULT_INCLUDE = "defaultInclude"; public static final String GENERATE_GMOCKS_FOR_APIS = "generateGMocksForApis"; + public static final String DEFAULT_PACKAGE_NAME = "CppRestOpenAPIClient"; + protected String packageName = ""; protected String packageVersion = "1.0.0"; protected String declspec = ""; protected String defaultInclude = ""; + protected String modelDirName = "model"; private final Set parentModels = new HashSet<>(); private final Multimap childrenByParent = ArrayListMultimap.create(); @@ -119,6 +122,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { cliOptions.clear(); // CLI options + addOption(CodegenConstants.PACKAGE_NAME, "C++ package (library) name.", DEFAULT_PACKAGE_NAME); addOption(CodegenConstants.MODEL_PACKAGE, "C++ namespace for models (convention: name.space.model).", this.modelPackage); addOption(CodegenConstants.API_PACKAGE, "C++ namespace for apis (convention: name.space.api).", @@ -159,6 +163,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("cmake-lists.mustache", "", "CMakeLists.txt")); + supportingFiles.add(new SupportingFile("cmake-config.mustache", "", "Config.cmake.in")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); languageSpecificPrimitives = new HashSet( @@ -195,6 +200,8 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { public void processOpts() { super.processOpts(); + packageName = (String) additionalProperties.getOrDefault(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME); + if (additionalProperties.containsKey(DECLSPEC)) { declspec = additionalProperties.get(DECLSPEC).toString(); } @@ -212,6 +219,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { additionalProperties.put("gmockApis", "true"); } + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); additionalProperties.put("modelNamespaceDeclarations", modelPackage.split("\\.")); additionalProperties.put("modelNamespace", modelPackage.replaceAll("\\.", "::")); additionalProperties.put("modelHeaderGuardPrefix", modelPackage.replaceAll("\\.", "_").toUpperCase(Locale.ROOT)); @@ -229,7 +237,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { */ @Override public String modelFileFolder() { - return outputFolder + "/model"; + return outputFolder + "/" + modelDirName; } /** @@ -246,7 +254,7 @@ public class CppRestSdkClientCodegen extends AbstractCppCodegen { if (importMapping.containsKey(name)) { return importMapping.get(name); } else { - return "#include \"" + toModelFilename(name) + ".h\""; + return "#include \"" + modelDirName + "/" + toModelFilename(name) + ".h\""; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 328a4b089b2..1e2740f1858 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -56,6 +56,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String USE_PLAY_WS = "usePlayWS"; public static final String PLAY_VERSION = "playVersion"; public static final String ASYNC_NATIVE = "asyncNative"; + public static final String CONFIG_KEY = "configKey"; public static final String PARCELABLE_MODEL = "parcelableModel"; public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; @@ -102,6 +103,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean usePlayWS = false; protected String playVersion = PLAY_26; protected String microprofileFramework = MICROPROFILE_DEFAULT; + protected String configKey = null; protected boolean asyncNative = false; protected boolean parcelableModel = false; @@ -160,6 +162,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(DYNAMIC_OPERATIONS, "Generate operations dynamically at runtime from an OAS", this.dynamicOperations)); cliOptions.add(CliOption.newBoolean(SUPPORT_STREAMING, "Support streaming endpoint (beta)", this.supportStreaming)); cliOptions.add(CliOption.newString(GRADLE_PROPERTIES, "Append additional Gradle proeprties to the gradle.properties file")); + cliOptions.add(CliOption.newString(CONFIG_KEY, "Config key in @RegisterRestClient. Default to none. Only `microprofile` supports this option.")); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.9.x. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libraries instead."); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.9.x"); @@ -281,6 +284,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen } additionalProperties.put(MICROPROFILE_FRAMEWORK, microprofileFramework); + if (additionalProperties.containsKey(CONFIG_KEY)) { + this.setConfigKey(additionalProperties.get(CONFIG_KEY).toString()); + } + if (additionalProperties.containsKey(ASYNC_NATIVE)) { this.setAsyncNative(convertPropertyToBooleanAndWriteBack(ASYNC_NATIVE)); } @@ -964,6 +971,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen this.microprofileFramework = microprofileFramework; } + public void setConfigKey(String configKey) { + this.configKey = configKey; + } + public void setParcelableModel(boolean parcelableModel) { this.parcelableModel = parcelableModel; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index c08ecec4e23..93d7428c236 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -379,7 +379,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen } else if (interfaceOnly) { apiTemplateFiles.put("apiInterface.mustache", ".kt"); } else { - apiTemplateFiles.put("api.mustache", ".kt"); + apiTemplateFiles.put("api.mustache", "Controller.kt"); apiTestTemplateFiles.put("api_test.mustache", ".kt"); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index a00b28395f6..f2c8033a233 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -44,6 +44,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode public static enum PROVIDED_IN_LEVEL {none, root, any, platform} private static final String DEFAULT_IMPORT_PREFIX = "./"; + private static final String DEFAULT_MODEL_IMPORT_DIRECTORY_PREFIX = "../"; public static final String NPM_REPOSITORY = "npmRepository"; public static final String WITH_INTERFACES = "withInterfaces"; @@ -634,7 +635,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode if (importMapping.containsKey(name)) { return importMapping.get(name); } - return modelPackage() + "/" + toModelFilename(name).substring(DEFAULT_IMPORT_PREFIX.length()); + return DEFAULT_MODEL_IMPORT_DIRECTORY_PREFIX + modelPackage() + "/" + toModelFilename(name).substring(DEFAULT_IMPORT_PREFIX.length()); } public String getNpmRepository() { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index ed922219016..71d53818647 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -708,15 +708,22 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege var.dataTypeAlternate = var.dataType; if (var.isArray) { + var.isUniqueId = var.isUniqueId || var.itemsAreUniqueId(); var.dataTypeAlternate = var.dataType.replace("Array<", "List<"); + String newItemsDataType = var.getItemsDataType(); if (var.items.isModel) { - String itemsDataType = var.items.dataType + "Record"; - var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, itemsDataType); + newItemsDataType = var.items.dataType + "Record"; + var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, newItemsDataType); } else if (var.items.isEnum) { - var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, var.items.datatypeWithEnum); + newItemsDataType = var.items.datatypeWithEnum; + var.dataTypeAlternate = var.dataTypeAlternate.replace(var.items.dataType, newItemsDataType); + } else if (var.isUniqueId) { + newItemsDataType = "string"; + var.dataTypeAlternate = var.dataTypeAlternate.replace("number", newItemsDataType); } - if (var.isUniqueId) { - var.dataTypeAlternate = var.dataTypeAlternate.replace("number", "string"); + + if (var.itemsAreNullable()) { + var.dataTypeAlternate = var.dataTypeAlternate.replace(newItemsDataType, newItemsDataType + " | null"); } } else if (var.isEnum) { var.dataTypeAlternate = var.datatypeWithEnum; @@ -724,6 +731,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege var.dataTypeAlternate = var.dataType + "Record"; } else if (var.isUniqueId) { var.dataTypeAlternate = "string"; + if (var.isNullable) { + var.dataTypeAlternate = var.dataTypeAlternate + " | null"; + } } if (var.defaultValue == null || var.defaultValue.equals("undefined")) { this.autoSetDefaultValueForProperty(var); @@ -732,6 +742,10 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege return parentIsEntity; } + private boolean itemsAreNullable(ExtendedCodegenProperty var) { + return var.items.isNullable || (var.items.items != null && var.items.items.isNullable); + } + private void escapeOperationIds(Map operations) { Map _operations = (Map) operations.get("operations"); List operationList = (List) _operations.get("operation"); @@ -816,19 +830,25 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege param.isUniqueId = this.isUniqueIdAccordingToNameSuffix(param.paramName); } + param.dataTypeAlternate = param.dataType; if (param.isArray) { + param.isUniqueId = param.isUniqueId || param.itemsAreUniqueId(); + param.dataTypeAlternate = param.dataType.replace("Array<", "List<"); + String newItemsDataType = param.getItemsDataType(); if (param.items.isModel) { - String itemsDataType = param.items.dataType + "Record"; - param.dataTypeAlternate = param.dataType.replace("Array<", "List<"); - param.dataTypeAlternate = param.dataTypeAlternate.replace(param.items.dataType, itemsDataType); + newItemsDataType = param.items.dataType + "Record"; + param.dataTypeAlternate = param.dataTypeAlternate.replace(param.items.dataType, newItemsDataType); } else if (param.items.isEnum) { + newItemsDataType = param.datatypeWithEnum.substring(param.datatypeWithEnum.lastIndexOf("<") + 1, param.datatypeWithEnum.indexOf(">")); param.dataTypeAlternate = param.datatypeWithEnum.replace("Array<", "List<"); - } else { - param.dataTypeAlternate = param.dataType.replace("Array<", "List<"); + } else if (param.isUniqueId) { + newItemsDataType = "string"; + param.dataTypeAlternate = param.dataTypeAlternate.replace("number", newItemsDataType); } - if (param.isUniqueId) { - param.dataTypeAlternate = param.dataTypeAlternate.replace("number", "string"); + + if (param.itemsAreNullable()) { + param.dataTypeAlternate = param.dataTypeAlternate.replace(newItemsDataType, newItemsDataType + " | null"); } } else if (param.isEnum) { param.dataTypeAlternate = param.datatypeWithEnum; @@ -836,6 +856,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege param.dataTypeAlternate = param.dataType + "Record"; } else if (param.isUniqueId) { param.dataTypeAlternate = "string"; + if (param.isNullable) { + param.dataTypeAlternate = param.dataTypeAlternate + " | null"; + } } } } @@ -912,10 +935,46 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege this.prefixParameterInterfaces = prefixParameterInterfaces; } + private static boolean itemsAreUniqueId(CodegenProperty items) { + if (items.items != null) { + return itemsAreUniqueId(items.items); + }; + if (items.vendorExtensions.get(X_IS_UNIQUE_ID) instanceof Boolean) { + return Boolean.TRUE.equals(items.vendorExtensions.get(X_IS_UNIQUE_ID)); + } + return false; + } + + private static boolean itemsAreNullable(CodegenProperty items) { + if (items.items != null) { + return itemsAreNullable(items.items); + }; + return items.isNullable; + } + + private static String getItemsDataType(CodegenProperty items) { + if (items.items != null) { + return getItemsDataType(items.items); + }; + return items.dataType; + } + class ExtendedCodegenParameter extends CodegenParameter { public String dataTypeAlternate; public boolean isUniqueId; // this parameter represents a unique id (x-isUniqueId: true) + public boolean itemsAreUniqueId() { + return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items); + } + + public boolean itemsAreNullable() { + return TypeScriptFetchClientCodegen.itemsAreNullable(this.items); + } + + public String getItemsDataType() { + return TypeScriptFetchClientCodegen.getItemsDataType(this.items); + } + public ExtendedCodegenParameter(CodegenParameter cp) { super(); @@ -1035,6 +1094,18 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege public boolean keepAsJSObject; public boolean isReservedRecordField; + public boolean itemsAreUniqueId() { + return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items); + } + + public boolean itemsAreNullable() { + return TypeScriptFetchClientCodegen.itemsAreNullable(this.items); + } + + public String getItemsDataType() { + return TypeScriptFetchClientCodegen.getItemsDataType(this.items); + } + public ExtendedCodegenProperty(CodegenProperty cp) { super(); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java index 54d27dc47a7..ef9178e610d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/HandlebarsEngineAdapter.java @@ -23,6 +23,7 @@ import com.github.jknack.handlebars.Template; import com.github.jknack.handlebars.context.FieldValueResolver; import com.github.jknack.handlebars.context.JavaBeanValueResolver; import com.github.jknack.handlebars.context.MapValueResolver; +import com.github.jknack.handlebars.context.MethodValueResolver; import com.github.jknack.handlebars.helper.ConditionalHelpers; import com.github.jknack.handlebars.helper.StringHelpers; import com.github.jknack.handlebars.io.AbstractTemplateLoader; @@ -46,6 +47,7 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter { // We use this as a simple lookup for valid file name extensions. This adapter will inspect .mustache (built-in) and infer the relevant handlebars filename private final String[] canCompileFromExtensions = new String[]{".handlebars",".hbs",".mustache"}; private boolean infiniteLoops = false; + private boolean prettyPrint = false; /** * Provides an identifier used to load the adapter. This could be a name, uuid, or any other string. @@ -71,7 +73,8 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter { .resolver( MapValueResolver.INSTANCE, JavaBeanValueResolver.INSTANCE, - FieldValueResolver.INSTANCE) + FieldValueResolver.INSTANCE, + MethodValueResolver.INSTANCE) .build(); Handlebars handlebars = new Handlebars(loader); @@ -84,6 +87,7 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter { handlebars.registerHelpers(ConditionalHelpers.class); handlebars.registerHelpers(org.openapitools.codegen.templating.handlebars.StringHelpers.class); handlebars.setInfiniteLoops(infiniteLoops); + handlebars.setPrettyPrint(prettyPrint); Template tmpl = handlebars.compile(templateFile); return tmpl.apply(context); } @@ -134,5 +138,9 @@ public class HandlebarsEngineAdapter extends AbstractTemplatingEngineAdapter { this.infiniteLoops = infiniteLoops; return this; } + + public void setPrettyPrint(boolean prettyPrint) { + this.prettyPrint = prettyPrint; + } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index 93944f967e2..3ce02e7a06e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index 766ddb5c52d..b705c38ff8d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -83,7 +82,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 @@ -94,9 +93,12 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache index 3297c77e49b..5d9692610ee 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/JSON.mustache @@ -5,6 +5,7 @@ import org.threeten.bp.*; {{/threetenbp}} import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; {{#openApiNullable}} import org.openapitools.jackson.nullable.JsonNullableModule; {{/openApiNullable}} @@ -36,7 +37,7 @@ public class JSON implements ContextResolver { public JSON() { mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index fcc366f710d..37d60273dee 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -121,7 +121,7 @@ ext { threetenbp_version = "2.9.10" {{/threetenbp}} {{#hasOAuthMethods}} - scribejava_apis_version = "6.9.0" + scribejava_apis_version = "8.3.1" {{/hasOAuthMethods}} {{#hasHttpSignatureMethods}} tomitribe_http_signatures_version = "1.7" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index f2c624f6799..3b16db61065 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -32,7 +32,7 @@ lazy val root = (project in file(".")). "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", {{/openApiNullable}} {{#hasOAuthMethods}} - "com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile", + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", {{/hasOAuthMethods}} {{#hasHttpSignatureMethods}} "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 50303b928e1..bd148d89abd 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -43,7 +43,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -63,7 +63,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -91,16 +91,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.2.0 - jar test-jar @@ -108,11 +106,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -145,14 +142,8 @@ maven-compiler-plugin 3.8.1 - {{#java8}} - 1.8 - 1.8 - {{/java8}} - {{^java8}} - 1.7 - 1.7 - {{/java8}} + 1.8 + 1.8 true 128m 512m @@ -165,7 +156,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -176,12 +167,7 @@ none - {{#java8}} - 1.8 - {{/java8}} - {{^java8}} - 1.7 - {{/java8}} + 1.8 http.response.details @@ -194,7 +180,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -305,13 +291,11 @@ ${jackson-version} {{/joda}} - {{#java8}} com.fasterxml.jackson.datatype jackson-datatype-jsr310 ${jackson-version} - {{/java8}} {{#threetenbp}} com.github.joschi.jackson @@ -319,14 +303,6 @@ ${threetenbp-version} {{/threetenbp}} - {{^java8}} - - - com.brsanthu - migbase64 - 2.2 - - {{/java8}} {{#hasHttpSignatureMethods}} org.tomitribe @@ -388,7 +364,7 @@ 1.7 {{/hasHttpSignatureMethods}} {{#hasOAuthMethods}} - 6.9.0 + 8.3.1 {{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache index f6a69ff6a7c..119494e54d3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache @@ -30,7 +30,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; */ {{/appName}} -@RegisterRestClient +@RegisterRestClient{{#configKey}}(configKey="{{configKey}}"){{/configKey}} @RegisterProvider(ApiExceptionMapper.class) @Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}") public interface {{classname}} { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache index 642e02c21c3..3d5f941907b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache @@ -77,7 +77,7 @@ org.eclipse.microprofile.rest.client microprofile-rest-client-api - 1.2.1 + 1.4.1 @@ -189,7 +189,7 @@ {{/useBeanValidation}} 3.2.7 2.9.7 - 1.2.2 + 1.2.2 1.3.5 1.0.2 1.1.6 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache index 46d8966d431..03d303d0dfb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache @@ -6,18 +6,16 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -33,9 +31,12 @@ javadoc { options.encoding = 'UTF-8' } -install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' +publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 0dc43ca4a86..829ff0b519e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -72,6 +72,9 @@ import {{invokerPackage}}.auth.RetryingOAuth; import {{invokerPackage}}.auth.OAuthFlow; {{/hasOAuthMethods}} +/** + *

ApiClient class.

+ */ public class ApiClient { private String basePath = "{{{basePath}}}"; @@ -100,7 +103,7 @@ public class ApiClient { private Map operationLookupMap = new HashMap<>(); {{/dynamicOperations}} - /* + /** * Basic constructor for ApiClient */ public ApiClient() { @@ -116,8 +119,10 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object */ public ApiClient(OkHttpClient client) { init(); @@ -136,28 +141,28 @@ public class ApiClient { {{#hasOAuthMethods}} {{#oauthMethods}} {{#-first}} - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID */ public ApiClient(String clientId) { this(clientId, null, null); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters */ public ApiClient(String clientId, Map parameters) { this(clientId, null, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters */ public ApiClient(String clientId, String clientSecret, Map parameters) { this(null, clientId, clientSecret, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters */ public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { @@ -264,7 +269,7 @@ public class ApiClient { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -336,6 +341,11 @@ public class ApiClient { return this; } + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ public KeyManager[] getKeyManagers() { return keyManagers; } @@ -353,15 +363,32 @@ public class ApiClient { return this; } + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ public DateFormat getDateFormat() { return dateFormat; } + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setDateFormat(DateFormat dateFormat) { this.json.setDateFormat(dateFormat); return this; } + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; @@ -380,17 +407,35 @@ public class ApiClient { {{/joda}} {{#jsr310}} + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setOffsetDateTimeFormat(dateFormat); return this; } + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); return this; } {{/jsr310}} + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLenientOnJson(boolean lenientOnJson) { this.json.setLenientOnJson(lenientOnJson); return this; @@ -610,7 +655,7 @@ public class ApiClient { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -632,7 +677,7 @@ public class ApiClient { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -654,7 +699,7 @@ public class ApiClient { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -945,7 +990,7 @@ public class ApiClient { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -1006,7 +1051,7 @@ public class ApiClient { * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws org.openapitools.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -1032,7 +1077,7 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -1052,7 +1097,7 @@ public class ApiClient { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -1096,7 +1141,7 @@ public class ApiClient { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1111,7 +1156,7 @@ public class ApiClient { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1124,6 +1169,14 @@ public class ApiClient { } {{#supportStreaming}} + /** + *

Execute stream.

+ * + * @param call a {@link okhttp3.Call} object + * @param returnType a {@link java.lang.reflect.Type} object + * @return a {@link java.io.InputStream} object + * @throws org.openapitools.client.ApiException if any. + */ public InputStream executeStream(Call call, Type returnType) throws ApiException { try { Response response = call.execute(); @@ -1192,7 +1245,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1238,7 +1291,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1260,7 +1313,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache index 1e277319a93..cecbaac1df2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache @@ -11,8 +11,6 @@ import java.util.TreeMap; /** * API response returned by API call. - * - * @param The type of data that is deserialized from response body */ public class ApiResponse { final private int statusCode; @@ -20,6 +18,8 @@ public class ApiResponse { final private T data; /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -28,6 +28,8 @@ public class ApiResponse { } /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -44,14 +46,29 @@ public class ApiResponse { this.data = data; } + /** + *

Get the status code.

+ * + * @return the status code + */ public int getStatusCode() { return statusCode; } + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ public Map> getHeaders() { return headers; } + /** + *

Get the data.

+ * + * @return the data + */ public T getData() { return data; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache index dd21bcad45f..a1a142bd488 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/README.mustache @@ -19,7 +19,7 @@ Building the API client library requires: 1. Java {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -55,7 +55,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + repositories { + mavenCentral() // Needed if the '{{{artifactId}}}' jar has been published to maven central. + mavenLocal() // Needed if the '{{{artifactId}}}' jar has been published to the local maven repo. + } + + dependencies { + implementation "{{{groupId}}}:{{{artifactId}}}:{{{artifactVersion}}}" + } ``` ### Others diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache index d28b1bd9630..68d872ceff8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache @@ -9,22 +9,47 @@ import java.util.Map.Entry; import java.util.TreeMap; {{/caseInsensitiveResponseHeaders}} +/** + *

ApiException class.

+ */ {{>generatedAnnotation}} public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + + /** + *

Constructor for ApiException.

+ */ public ApiException() {} + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ public ApiException(Throwable throwable) { super(throwable); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ public ApiException(String message) { super(message); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -38,23 +63,60 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us this.responseBody = responseBody; } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, Map> responseHeaders, String responseBody) { this((String) null, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ public ApiException(int code, String message) { super(message); this.code = code; } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); {{#caseInsensitiveResponseHeaders}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index 780b025dbc7..6cd8e351291 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -57,7 +57,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -77,7 +77,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -104,16 +104,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.2.0 - jar test-jar @@ -121,11 +119,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -156,7 +153,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -179,7 +176,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -200,7 +197,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -278,7 +275,7 @@ io.swagger.parser.v3 swagger-parser-v3 - 2.0.23 + 2.0.28 {{/dynamicOperations}} {{#useBeanValidation}} @@ -295,7 +292,7 @@ org.hibernate hibernate-validator - 5.4.1.Final + 5.4.3.Final jakarta.el @@ -335,19 +332,19 @@ org.mockito mockito-core - 3.11.2 + 3.12.4 test - {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + 1.8 ${java.version} ${java.version} 1.8.5 - 1.6.2 - 4.9.1 - 2.8.6 - 3.11 + 1.6.3 + 4.9.2 + 2.8.8 + 3.12.0 {{#openApiNullable}} 0.2.1 {{/openApiNullable}} @@ -362,9 +359,9 @@ 3.0.3 {{/performBeanValidation}} {{#useBeanValidation}} - 2.0.2 + 2.0.2 {{/useBeanValidation}} - 4.13.1 + 4.13.2 UTF-8 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache index a1db459b5ae..2294f8808f2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache index 67083a02010..d43c2b7874b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,13 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' + sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index 43c5845302c..c915f08bb2a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -83,7 +82,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 @@ -94,9 +93,12 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache index 34d66a2d530..1266cde37cc 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -83,14 +82,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index fe9207df02d..bb1ca7c917b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -83,7 +82,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 @@ -94,9 +93,12 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache index 1fce1c6262c..bd45198caa8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache @@ -5,19 +5,21 @@ group = '{{groupId}}' version = '{{artifactVersion}}' repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 -install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' +publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache index d419eb4010d..08917cfd909 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,8 +15,7 @@ buildscript { } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } if(hasProperty('target') && target == 'android') { @@ -84,7 +82,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 @@ -95,9 +93,12 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache index 3b1c75e86d1..135d033f747 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/api-header.mustache @@ -9,12 +9,11 @@ #define {{apiHeaderGuardPrefix}}_{{classname}}_H_ {{{defaultInclude}}} -#include "../ApiClient.h" +#include "ApiClient.h" +{{^hasModelImport}}#include "ModelBase.h"{{/hasModelImport}} {{#imports}}{{{import}}} {{/imports}} -{{^hasModelImport}}#include "../ModelBase.h"{{/hasModelImport}} - #include {{#apiNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache new file mode 100644 index 00000000000..2a485225c0c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) + +check_required_components("@PROJECT_NAME@") diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache index b882ea0e723..71f12cad0f8 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-lists.mustache @@ -8,69 +8,85 @@ # # NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.1) -#PROJECT's NAME -project(CppRestOpenAPIClient) -set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) +project({{{packageName}}}) -# THE LOCATION OF OUTPUT BINARIES -set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CXX_STANDARD_REQUIRED ON) + +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -# BUILD TYPE -message("A ${CMAKE_BUILD_TYPE} build configuration is detected") +find_package(cpprestsdk REQUIRED) +find_package(Boost REQUIRED) + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + +file(GLOB_RECURSE HEADER_FILES "*.h") +file(GLOB_RECURSE SOURCE_FILES "*.cpp") + +add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) + +target_compile_options(${PROJECT_NAME} + PRIVATE + $<$,$,$>: + -Wall -Wno-unused-variable> +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ +) + +target_link_directories(${PROJECT_NAME} + PRIVATE + ${Boost_LIBRARY_DIRS} +) if (UNIX) message(STATUS "Building client library for Linux/Unix") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") - set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/) - - find_package(cpprestsdk REQUIRED) - find_package(Boost REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC cpprest ${Boost_LIBRARIES} crypto) else() message(STATUS "Building client library for Windows") - find_package(cpprestsdk REQUIRED) - find_package(Boost REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt) endif() -# Manually set the cpprestsdk paths when not using package manager -#set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) -#set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) -#include_directories(${CPPREST_INCLUDE_DIR}) -#link_directories(${CPPREST_LIBRARY_DIR}) - -#SUPPORTING FILES -set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object") -#SOURCE FILES -file(GLOB SOURCE_FILES "api/*" "model/*") - -add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) - -target_include_directories( - ${PROJECT_NAME} PRIVATE - ${Boost_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/model - ${CMAKE_CURRENT_SOURCE_DIR}/api +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" ) -target_link_directories( - ${PROJECT_NAME} PRIVATE - ${Boost_LIBRARY_DIRS} +install( + TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}Targets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -if (UNIX) - target_link_libraries(${PROJECT_NAME} PRIVATE cpprest ${Boost_LIBRARIES} crypto) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt) -endif() +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} + FILES_MATCHING PATTERN "*.h" +) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) + +install( + EXPORT ${PROJECT_NAME}Targets + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache index f8ba4b95e7f..c67a886e915 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache @@ -10,7 +10,7 @@ {{^parent}} {{{defaultInclude}}} -#include "../ModelBase.h" +#include "ModelBase.h" {{/parent}} {{#imports}}{{{this}}} diff --git a/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache b/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache index 05a17cb8f0a..1a7e69fd1cd 100644 --- a/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/crystal/gitignore.mustache @@ -1,39 +1,14 @@ # Generated by: https://openapi-generator.tech # -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/spec/examples.txt -/test/tmp/ -/test/version_tmp/ +/docs/ +/lib/ +/bin/ +/.shards/ +*.dwarf + +# Libraries don't need dependency lock +# Dependencies will be locked in applications that use them +/shard.lock + /tmp/ - -## Specific to RubyMotion: -.dat* -.repl_history -build/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalization: -/.bundle/ -/vendor/bundle -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc diff --git a/modules/openapi-generator/src/main/resources/crystal/rspec.mustache b/modules/openapi-generator/src/main/resources/crystal/rspec.mustache deleted file mode 100644 index 83e16f80447..00000000000 --- a/modules/openapi-generator/src/main/resources/crystal/rspec.mustache +++ /dev/null @@ -1,2 +0,0 @@ ---color ---require spec_helper diff --git a/modules/openapi-generator/src/main/resources/crystal/rubocop.mustache b/modules/openapi-generator/src/main/resources/crystal/rubocop.mustache deleted file mode 100644 index d32b2b1cdab..00000000000 --- a/modules/openapi-generator/src/main/resources/crystal/rubocop.mustache +++ /dev/null @@ -1,148 +0,0 @@ -# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) -# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) -AllCops: - TargetRubyVersion: 2.4 - # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop - # to ignore them, so only the ones explicitly set in this file are enabled. - DisabledByDefault: true - Exclude: - - '**/templates/**/*' - - '**/vendor/**/*' - - 'actionpack/lib/action_dispatch/journey/parser.rb' - -# Prefer &&/|| over and/or. -Style/AndOr: - Enabled: true - -# Align `when` with `case`. -Layout/CaseIndentation: - Enabled: true - -# Align comments with method definitions. -Layout/CommentIndentation: - Enabled: true - -Layout/ElseAlignment: - Enabled: true - -Layout/EmptyLineAfterMagicComment: - Enabled: true - -# In a regular class definition, no empty lines around the body. -Layout/EmptyLinesAroundClassBody: - Enabled: true - -# In a regular method definition, no empty lines around the body. -Layout/EmptyLinesAroundMethodBody: - Enabled: true - -# In a regular module definition, no empty lines around the body. -Layout/EmptyLinesAroundModuleBody: - Enabled: true - -Layout/FirstArgumentIndentation: - Enabled: true - -# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. -Style/HashSyntax: - Enabled: false - -# Method definitions after `private` or `protected` isolated calls need one -# extra level of indentation. -Layout/IndentationConsistency: - Enabled: true - EnforcedStyle: indented_internal_methods - -# Two spaces, no tabs (for indentation). -Layout/IndentationWidth: - Enabled: true - -Layout/LeadingCommentSpace: - Enabled: true - -Layout/SpaceAfterColon: - Enabled: true - -Layout/SpaceAfterComma: - Enabled: true - -Layout/SpaceAroundEqualsInParameterDefault: - Enabled: true - -Layout/SpaceAroundKeyword: - Enabled: true - -Layout/SpaceAroundOperators: - Enabled: true - -Layout/SpaceBeforeComma: - Enabled: true - -Layout/SpaceBeforeFirstArg: - Enabled: true - -Style/DefWithParentheses: - Enabled: true - -# Defining a method with parameters needs parentheses. -Style/MethodDefParentheses: - Enabled: true - -Style/FrozenStringLiteralComment: - Enabled: false - EnforcedStyle: always - -# Use `foo {}` not `foo{}`. -Layout/SpaceBeforeBlockBraces: - Enabled: true - -# Use `foo { bar }` not `foo {bar}`. -Layout/SpaceInsideBlockBraces: - Enabled: true - -# Use `{ a: 1 }` not `{a:1}`. -Layout/SpaceInsideHashLiteralBraces: - Enabled: true - -Layout/SpaceInsideParens: - Enabled: true - -# Check quotes usage according to lint rule below. -#Style/StringLiterals: -# Enabled: true -# EnforcedStyle: single_quotes - -# Detect hard tabs, no hard tabs. -Layout/IndentationStyle: - Enabled: true - -# Blank lines should not have any spaces. -Layout/TrailingEmptyLines: - Enabled: true - -# No trailing whitespace. -Layout/TrailingWhitespace: - Enabled: false - -# Use quotes for string literals when they are enough. -Style/RedundantPercentQ: - Enabled: true - -# Align `end` with the matching keyword or starting expression except for -# assignments, where it should be aligned with the LHS. -Layout/EndAlignment: - Enabled: true - EnforcedStyleAlignWith: variable - AutoCorrect: true - -# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. -Lint/RequireParentheses: - Enabled: true - -Style/RedundantReturn: - Enabled: true - AllowMultipleReturnValues: true - -Style/Semicolon: - Enabled: true - AllowAsExpressionSeparator: true diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache index 11bc668b902..b144bd50495 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache @@ -106,7 +106,7 @@ class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> { {{/isContainer}} {{#isModel}} {{#isPrimitiveType}} - {{! These are models that have nee manually marked as primitve via generator param. }} + {{! These are models that have nee manually marked as primitive via generator param. }} result.{{{name}}} = valueDes; {{/isPrimitiveType}} {{^isPrimitiveType}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache index 69c162d7b6f..699361be13f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "{{groupId}}" version = "{{artifactVersion}}" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/modules/openapi-generator/src/main/resources/powershell/api_client.mustache b/modules/openapi-generator/src/main/resources/powershell/api_client.mustache index 5c364247594..2435b7b0ced 100644 --- a/modules/openapi-generator/src/main/resources/powershell/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/powershell/api_client.mustache @@ -56,9 +56,15 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { $HeaderParameters['Accept'] = $Accept } + [string]$MultiPartBoundary = $null $ContentType= SelectHeaders -Headers $ContentTypes if ($ContentType) { $HeaderParameters['Content-Type'] = $ContentType + if ($ContentType -eq 'multipart/form-data') { + [string]$MultiPartBoundary = [System.Guid]::NewGuid() + $MultiPartBoundary = "---------------------------$MultiPartBoundary" + $HeaderParameters['Content-Type'] = "$ContentType; boundary=$MultiPartBoundary" + } } # add default headers if any @@ -66,7 +72,6 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { $HeaderParameters[$header.Name] = $header.Value } - # construct URL query string $HttpValues = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) foreach ($Parameter in $QueryParameters.GetEnumerator()) { @@ -84,9 +89,34 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { # include form parameters in the request body if ($FormParameters -and $FormParameters.Count -gt 0) { - $RequestBody = $FormParameters + if (![string]::IsNullOrEmpty($MultiPartBoundary)) { + $RequestBody = "" + $LF = "`r`n" + $FormParameters.Keys | ForEach-Object { + $value = $FormParameters[$_] + $isFile = $value.GetType().FullName -eq "System.IO.FileInfo" + + $RequestBody += "--$MultiPartBoundary$LF" + $RequestBody += "Content-Disposition: form-data; name=`"$_`"" + if ($isFile) { + $fileName = $value.Name + $RequestBody += "; filename=`"$fileName`"$LF" + $RequestBody += "Content-Type: application/octet-stream$LF$LF" + $RequestBody += Get-Content -Path $value.FullName + } else { + $RequestBody += "$LF$LF" + $RequestBody += ([string]$value) + } + $RequestBody += "$LF--$MultiPartBoundary" + } + $RequestBody += "--" + } else { + $RequestBody = $FormParameters + } } + + if ($Body -or $IsBodyNullable) { $RequestBody = $Body if ([string]::IsNullOrEmpty($RequestBody) -and $IsBodyNullable -eq $true) { diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache index ac15aa430ea..8e586cf68ce 100644 --- a/modules/openapi-generator/src/main/resources/python/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache @@ -278,6 +278,9 @@ conf = {{{packageName}}}.Configuration( self.proxy = None """Proxy URL """ + self.no_proxy = None + """bypass proxy for host in the no_proxy list. + """ self.proxy_headers = None """Proxy headers """ diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache index 21c8d5b44c0..d4293e70da2 100644 --- a/modules/openapi-generator/src/main/resources/python/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/rest.mustache @@ -6,8 +6,10 @@ import logging import re import ssl from urllib.parse import urlencode - +from urllib.parse import urlparse +from urllib.request import proxy_bypass_environment import urllib3 +import ipaddress from {{packageName}}.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError @@ -64,7 +66,7 @@ class RESTClientObject(object): maxsize = 4 # https pool manager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): self.pool_manager = urllib3.ProxyManager( num_pools=pools_size, maxsize=maxsize, @@ -282,3 +284,55 @@ class RESTClientObject(object): _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) + +# end of class RESTClientObject +def is_ipv4(target): + """ Test if IPv4 address or not + """ + try: + chk = ipaddress.IPv4Address(target) + return True + except ipaddress.AddressValueError: + return False + +def in_ipv4net(target, net): + """ Test if target belongs to given IPv4 network + """ + try: + nw = ipaddress.IPv4Network(net) + ip = ipaddress.IPv4Address(target) + if ip in nw: + return True + return False + except ipaddress.AddressValueError: + return False + except ipaddress.NetmaskValueError: + return False + +def should_bypass_proxies(url, no_proxy=None): + """ Yet another requests.should_bypass_proxies + Test if proxies should not be used for a particular url. + """ + + parsed = urlparse(url) + + # special cases + if parsed.hostname in [None, '']: + return True + + # special cases + if no_proxy in [None , '']: + return False + if no_proxy == '*': + return True + + no_proxy = no_proxy.lower().replace(' ',''); + entries = ( + host for host in no_proxy.split(',') if host + ) + + if is_ipv4(parsed.hostname): + for item in entries: + if in_ipv4net(parsed.hostname, item): + return True + return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/modules/openapi-generator/src/main/resources/scala-httpclient/build.gradle.mustache b/modules/openapi-generator/src/main/resources/scala-httpclient/build.gradle.mustache index 2ad0d4a0de0..93a6adbe1b8 100644 --- a/modules/openapi-generator/src/main/resources/scala-httpclient/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/scala-httpclient/build.gradle.mustache @@ -6,7 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -15,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +77,17 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'scala' apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache index 02c52d23355..4c5355be9ad 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache @@ -9,9 +9,11 @@ import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; {{#imports}} -import { {{classname}} } from '../model/models'; +// @ts-ignore +import { {{ classname }} } from '{{ filename }}'; {{/imports}} +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { {{configurationClassName}} } from '../configuration'; {{#withInterfaces}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index fb3d06db22c..74c0c77d712 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -337,7 +337,7 @@ export class {{classname}} extends runtime.BaseAPI { return await response.value(); {{/returnType}} {{^returnType}} - await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }{{/allParams.0}}, initOverrides); + await this.{{nickname}}Raw({{#allParams.0}}{ {{#allParams}}{{paramName}}: {{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }, {{/allParams.0}}initOverrides); {{/returnType}} } {{/useSingleRequestParameter}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache index b418276e452..ebdb5fd2498 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/recordGeneric.mustache @@ -96,7 +96,17 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname (apiObject as any).recType = {{#isEntity}}asEntity ? {{classname}}RecordEntityProps.recType : {{/isEntity}}{{classname}}RecordProps.recType; {{#vars}} {{#isUniqueId}} - {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.{{#isArray}}map(item => item.{{/isArray}}toString(){{#isArray}}){{/isArray}};{{^required}} } {{/required}} + {{#isArray}} + {{#items.isArray}} + {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.map(item => item.map(item2 => item2?.toString()));{{^required}} } {{/required}} + {{/items.isArray}} + {{^items.isArray}} + {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.map(item => item?.toString());{{^required}} } {{/required}} + {{/items.isArray}} + {{/isArray}} + {{^isArray}} + {{^required}}if (apiObject.{{name}}) { {{/required}}(apiObject as any).{{name}} = apiObject.{{name}}.toString();{{^required}} } {{/required}} + {{/isArray}} {{/isUniqueId}} {{^keepAsJSObject}} {{#isModel}} @@ -134,6 +144,7 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname public *toInlined(entityId?: string | null) { if (!entityId) {return undefined; } + // @ts-ignore const entity = yield select(apiEntity{{classname}}Selector, {id: entityId}); if (!entity) {return undefined; } @@ -160,12 +171,14 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname {{#vars}} {{#isEntity}} {{^keepAsJSObject}} + // @ts-ignore {{name}}: {{^required}}entity.{{name}} ? {{/required}}yield call({{#lambda.camelcase}}{{{dataTypeAlternate}}}{{/lambda.camelcase}}Utils.toInlined, entity.{{name}}){{^required}} : null{{/required}}, {{/keepAsJSObject}} {{/isEntity}} {{#isArray}} {{#items.isEntity}} {{^keepAsJSObject}} + // @ts-ignore {{name}}: {{^required}}entity.{{name}} ? {{/required}}yield call({{#lambda.camelcase}}{{items.dataType}}{{/lambda.camelcase}}RecordUtils.toInlinedArray, entity.{{name}}){{^required}} : null{{/required}}, {{/keepAsJSObject}} {{/items.isEntity}} @@ -183,6 +196,7 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname if (!entityIds) {return null; } let entities = List<{{classname}}Record>(); for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) { + // @ts-ignore const entity = yield call(this.toInlined, entityIds.get(entityIndex)); if (entity) { entities.push(entity); @@ -196,7 +210,17 @@ class {{classname}}RecordUtils extends ApiRecordUtils<{{classname}}, {{classname const apiObject = super.toApi(record); {{#vars}} {{#isUniqueId}} - {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => parseFloat(item)).toArray(){{/isArray}}{{^isArray}}parseFloat(record.{{name}}){{/isArray}};{{^required}} } {{/required}} + {{#isArray}} + {{#items.isArray}} + {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(){{/isArray}};{{^required}} } {{/required}} + {{/items.isArray}} + {{^items.isArray}} + {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{#isArray}}record.{{name}}.map(item => (item ? parseFloat(item) : null) as number).toArray(){{/isArray}};{{^required}} } {{/required}} + {{/items.isArray}} + {{/isArray}} + {{^isArray}} + {{^required}}if (record.{{name}}) { {{/required}}apiObject.{{name}} = {{^isArray}}parseFloat(record.{{name}}){{/isArray}};{{^required}} } {{/required}} + {{/isArray}} {{/isUniqueId}} {{^keepAsJSObject}} {{#isModel}} diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache index af6fa7fdd71..9713d9e632d 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/sagaApiManager.mustache @@ -18,15 +18,7 @@ export class Api { {{/apis}} {{/apiInfo}} - public static init(apiBasePath: string) { - const apiBaseConfig: ConfigurationParameters = { - basePath: apiBasePath, - credentials: "include", - headers: { - 'Cache-Control': 'no-cache, no-store' // this is needed to prevent stalling issues in Chrome. Also it is a good behavior for api calls. - } - }; - + public static init(apiBaseConfig: ConfigurationParameters) { {{#apiInfo}} {{#apis}} Api.{{#lambda.camelcase}}{{classFilename}}{{/lambda.camelcase}} = new {{classFilename}}(new Configuration(apiBaseConfig)); diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache index 5129d92758c..2aca1ebc23b 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/sagas.mustache @@ -105,12 +105,17 @@ export function *{{nickname}}SagaImp(_action_: Action{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.{{nickname}}, + const response{{#returnType}}: Required<{{{returnType}}}>{{/returnType}} = yield apiCall(Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}, Api.{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}.{{nickname}}, {{#allParams.0}} {{#allParams}} {{#isUniqueId}} {{#isArray}} - {{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => parseFloat(p)).toArray(){{^required}} : undefined{{/required}}, +{{#items.isArray}} + {{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => p.toArray().map(p2 => (p2 ? parseFloat(p2) : null) as number)).toArray(){{^required}} : undefined{{/required}}, +{{/items.isArray}} +{{^items.isArray}} + {{^required}}{{paramName}} ? {{/required}}{{paramName}}.map(p => (p ? parseFloat(p) : null) as number ).toArray(){{^required}} : undefined{{/required}}, +{{/items.isArray}} {{/isArray}} {{^isArray}} {{^required}}{{paramName}} ? {{/required}}parseFloat({{paramName}}){{^required}} : undefined{{/required}}, diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index 6a506a7221f..f949ac99bec 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -285,7 +285,7 @@ public class KotlinSpringServerCodegenTest { generator.opts(input).generate(); - assertFileNotContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PonyApi.kt"), "@RequestParam"); + assertFileNotContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PonyApiController.kt"), "@RequestParam"); } @Test @@ -315,14 +315,14 @@ public class KotlinSpringServerCodegenTest { generator.opts(input).generate(); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/MonkeysApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ElephantsApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ZebrasApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/BearsApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/CamelsApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PandasApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/CrocodilesApi.kt"), "@RequestParam"); - assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PolarBearsApi.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/MonkeysApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ElephantsApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ZebrasApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/BearsApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/CamelsApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PandasApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/CrocodilesApiController.kt"), "@RequestParam"); + assertFileContains(Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/PolarBearsApiController.kt"), "@RequestParam"); } @Test @@ -352,11 +352,11 @@ public class KotlinSpringServerCodegenTest { generator.opts(input).generate(); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ElephantsApi.kt"), + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ElephantsApiController.kt"), "@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)" ); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ZebrasApi.kt"), + Paths.get(outputPath + "/src/main/kotlin/org/openapitools/api/ZebrasApiController.kt"), "@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE_TIME)" ); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java index db8a5b29cd0..4e7d98d2874 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/markdown/MarkdownSampleGeneratorTest.java @@ -50,4 +50,4 @@ public class MarkdownSampleGeneratorTest { } } -} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java index 2ba80266215..bb470c5c315 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientTest.java @@ -29,6 +29,7 @@ import io.swagger.v3.parser.util.SchemaTypeUtil; import java.io.File; import java.math.BigDecimal; import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -464,4 +465,26 @@ public class PythonClientTest { } + @Test(description = "tests NoProxyPyClient") + public void testNoProxyPyClient() throws Exception { + + final String gen = "python"; + final String spec = "src/test/resources/3_0/petstore.yaml"; + + File output = Files.createTempDirectory("test").toFile(); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName(gen) + .setInputSpec(spec) + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(clientOptInput).generate(); + + for (String f : new String[] { "openapi_client/configuration.py", "openapi_client/rest.py" } ) { + TestUtils.ensureContainsFile(files, output, f); + Path p = output.toPath().resolve(f); + TestUtils.assertFileContains(p, "no_proxy"); + } + } + } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java index 07e2216710b..e5a76bd02a3 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java @@ -228,7 +228,7 @@ public class TypeScriptAngularClientCodegenTest { OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("test", schema); codegen.setOpenAPI(openAPI); - Assert.assertEquals(codegen.toModelImport(modelName), "model/foo-response-links"); + Assert.assertEquals(codegen.toModelImport(modelName), "../model/foo-response-links"); Assert.assertEquals(codegen.toModelFilename(modelName), "./foo-response-links"); } @@ -258,4 +258,13 @@ public class TypeScriptAngularClientCodegenTest { Assert.assertEquals(codegen.toParamName("valid_id"), "ValidId"); Assert.assertEquals(codegen.toParamName("illegal-id+"), "IllegalId"); } + + @Test + public void testCorrectlyProducesImportsWithImportMapping() { + TypeScriptAngularClientCodegen codegen = new TypeScriptAngularClientCodegen(); + final String importedModel = "SharedApiModel"; + final String importName = "@lib/custom/model"; + codegen.importMapping().put(importedModel, importName); + Assert.assertEquals(codegen.toModelImport(importedModel), importName); + } } diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml index 6455e05eebb..29c48ddc0bd 100644 --- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing-saga-and-records.yaml @@ -295,6 +295,46 @@ paths: - 'write:pets' - 'read:pets' deprecated: true + '/pet/{petId}/regions': + get: + tags: + - pet + summary: Gets regions for a single pet. + operationId: getPetRegions + parameters: + - name: petId + in: path + description: ID of pet + required: true + type: integer + format: int64 + responses: + 200: + description: OK + schema: + $ref: "#/definitions/PetRegionsResponse" + put: + tags: + - pet + summary: Updates the pet regions. + operationId: updatePetRegions + parameters: + - name: petId + in: path + description: ID of pet + required: true + type: integer + format: int64 + - in: body + name: new-regions + required: true + schema: + $ref: "#/definitions/PetRegions" + responses: + 200: + description: OK + schema: + $ref: "#/definitions/PetRegionsResponse" '/pet/{petId}': get: tags: @@ -902,6 +942,8 @@ definitions: - pending - sold default: pending + regions: + $ref: "#/definitions/PetRegions" xml: name: Pet ApiResponse: @@ -1127,6 +1169,15 @@ definitions: - Long description: "Type of pet part" example: Linear + PetRegionsResponse: + type: object + required: + - meta + properties: + meta: + $ref: "#/definitions/ResponseMeta" + data: + $ref: "#/definitions/PetRegions" GetMatchingPartsResponse: type: object required: @@ -1173,3 +1224,14 @@ definitions: StringBooleanMap: additionalProperties: type: boolean + PetRegions: + type: array + description: "An array of all 15-minute time slots in 24 hours." + items: + type: array + items: + description: "array of values entity id or null." + x-nullable: true + x-isUniqueId: true + type: integer + format: int64 diff --git a/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache index 95c49396bfa..cff97a389dc 100644 --- a/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/test/resources/2_0/templates/Java/libraries/jersey2/build.gradle.mustache @@ -6,8 +6,7 @@ version = '{{artifactVersion}}' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -83,7 +82,7 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' {{#java8}} sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -93,9 +92,12 @@ if(hasProperty('target') && target == 'android') { targetCompatibility = JavaVersion.VERSION_1_7 {{/java8}} - install { - repositories.mavenInstaller { - pom.artifactId = '{{artifactId}}' + publishing { + publications { + maven(MavenPublication) { + artifactId = '{{artifactId}}' + from components.java + } } } diff --git a/pom.xml b/pom.xml index db6fcc92911..eb82b6fcf13 100644 --- a/pom.xml +++ b/pom.xml @@ -1172,7 +1172,6 @@ - samples/server/petstore/kotlin-springboot samples/server/petstore/jaxrs/jersey2 samples/server/petstore/jaxrs/jersey2-useTags samples/server/petstore/spring-mvc @@ -1230,7 +1229,6 @@ samples/server/petstore/scala-akka-http-server samples/server/petstore/scalatra samples/server/petstore/scala-finch - @@ -1247,6 +1245,33 @@ samples/client/petstore/python samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent samples/openapi3/client/petstore/python + + + samples/client/petstore/typescript-angular-v7-provided-in-root + samples/client/petstore/typescript-angular-v11-provided-in-root + samples/openapi3/client/petstore/typescript/builds/default + samples/openapi3/client/petstore/typescript/tests/default + samples/openapi3/client/petstore/typescript/builds/jquery + samples/openapi3/client/petstore/typescript/tests/jquery + samples/openapi3/client/petstore/typescript/builds/object_params + samples/openapi3/client/petstore/typescript/tests/object_params + samples/openapi3/client/petstore/typescript/builds/inversify + + samples/client/petstore/typescript-fetch/builds/default + samples/client/petstore/typescript-fetch/builds/es6-target + samples/client/petstore/typescript-fetch/builds/with-npm-version + samples/client/petstore/typescript-fetch/tests/default + samples/client/petstore/typescript-node/npm + samples/client/petstore/typescript-rxjs/builds/with-npm-version + samples/client/petstore/typescript-axios/builds/with-npm-version + samples/client/petstore/typescript-axios/tests/default + samples/client/petstore/javascript-flowtyped + samples/client/petstore/javascript-es6 + samples/client/petstore/javascript-promise-es6 @@ -1290,39 +1315,6 @@ samples/client/petstore/java/microprofile-rest-client samples/client/petstore/java/apache-httpclient samples/client/petstore/groovy - - samples/client/petstore/go - samples/openapi3/client/petstore/go - samples/client/petstore/javascript-flowtyped - samples/client/petstore/javascript-es6 - samples/client/petstore/javascript-promise-es6 - samples/server/petstore/go-api-server - samples/server/petstore/go-gin-api-server - samples/server/petstore/go-echo-server - - - samples/client/petstore/typescript-angular-v7-provided-in-root - samples/client/petstore/typescript-angular-v11-provided-in-root - samples/openapi3/client/petstore/typescript/builds/default - samples/openapi3/client/petstore/typescript/tests/default - samples/openapi3/client/petstore/typescript/builds/jquery - samples/openapi3/client/petstore/typescript/tests/jquery - samples/openapi3/client/petstore/typescript/builds/object_params - samples/openapi3/client/petstore/typescript/tests/object_params - samples/openapi3/client/petstore/typescript/builds/inversify - - samples/client/petstore/typescript-fetch/builds/default - samples/client/petstore/typescript-fetch/builds/es6-target - samples/client/petstore/typescript-fetch/builds/with-npm-version - samples/client/petstore/typescript-fetch/tests/default - samples/client/petstore/typescript-node/npm - samples/client/petstore/typescript-rxjs/builds/with-npm-version - samples/client/petstore/typescript-axios/builds/with-npm-version - samples/client/petstore/typescript-axios/tests/default @@ -1356,6 +1348,8 @@ samples/client/petstore/kotlin-threetenbp samples/client/petstore/kotlin-uppercase-enum + samples/server/petstore/kotlin-springboot + @@ -1388,6 +1382,12 @@ + + samples/client/petstore/go + samples/openapi3/client/petstore/go + samples/server/petstore/go-api-server + samples/server/petstore/go-gin-api-server + samples/server/petstore/go-echo-server diff --git a/samples/client/others/java/okhttp-gson-streaming/README.md b/samples/client/others/java/okhttp-gson-streaming/README.md index 4f967a17bac..418a3fb4278 100644 --- a/samples/client/others/java/okhttp-gson-streaming/README.md +++ b/samples/client/others/java/okhttp-gson-streaming/README.md @@ -13,7 +13,7 @@ No description provided (generated by Openapi Generator https://github.com/opena Building the API client library requires: 1. Java 1.7+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -49,7 +49,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-okhttp-gson:1.0" + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-gson' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-gson' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-gson:1.0" + } ``` ### Others diff --git a/samples/client/others/java/okhttp-gson-streaming/pom.xml b/samples/client/others/java/okhttp-gson-streaming/pom.xml index 8c0abdf8e1e..243592e2799 100644 --- a/samples/client/others/java/okhttp-gson-streaming/pom.xml +++ b/samples/client/others/java/okhttp-gson-streaming/pom.xml @@ -50,7 +50,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -97,16 +97,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.2.0 - jar test-jar @@ -114,11 +112,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -149,7 +146,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -172,7 +169,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -193,7 +190,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -272,23 +269,23 @@ org.mockito mockito-core - 3.11.2 + 3.12.4 test - 1.7 + 1.8 ${java.version} ${java.version} 1.8.5 - 1.6.2 - 4.9.1 - 2.8.6 - 3.11 + 1.6.3 + 4.9.2 + 2.8.8 + 3.12.0 0.2.1 1.5.0 1.3.5 - 4.13.1 + 4.13.2 UTF-8 diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java index c48b4479cc6..88b271de498 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiClient.java @@ -54,6 +54,9 @@ import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; import org.openapitools.client.auth.ApiKeyAuth; +/** + *

ApiClient class.

+ */ public class ApiClient { private String basePath = "http://localhost:8082"; @@ -78,7 +81,7 @@ public class ApiClient { private HttpLoggingInterceptor loggingInterceptor; - /* + /** * Basic constructor for ApiClient */ public ApiClient() { @@ -90,8 +93,10 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object */ public ApiClient(OkHttpClient client) { init(); @@ -162,7 +167,7 @@ public class ApiClient { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -234,6 +239,11 @@ public class ApiClient { return this; } + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ public KeyManager[] getKeyManagers() { return keyManagers; } @@ -251,30 +261,65 @@ public class ApiClient { return this; } + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ public DateFormat getDateFormat() { return dateFormat; } + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setDateFormat(DateFormat dateFormat) { this.json.setDateFormat(dateFormat); return this; } + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; } + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setOffsetDateTimeFormat(dateFormat); return this; } + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); return this; } + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLenientOnJson(boolean lenientOnJson) { this.json.setLenientOnJson(lenientOnJson); return this; @@ -471,7 +516,7 @@ public class ApiClient { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -493,7 +538,7 @@ public class ApiClient { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -515,7 +560,7 @@ public class ApiClient { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -749,7 +794,7 @@ public class ApiClient { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -810,7 +855,7 @@ public class ApiClient { * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws org.openapitools.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -836,7 +881,7 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -856,7 +901,7 @@ public class ApiClient { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -900,7 +945,7 @@ public class ApiClient { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -915,7 +960,7 @@ public class ApiClient { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -927,6 +972,14 @@ public class ApiClient { } } + /** + *

Execute stream.

+ * + * @param call a {@link okhttp3.Call} object + * @param returnType a {@link java.lang.reflect.Type} object + * @return a {@link java.io.InputStream} object + * @throws org.openapitools.client.ApiException if any. + */ public InputStream executeStream(Call call, Type returnType) throws ApiException { try { Response response = call.execute(); @@ -994,7 +1047,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1040,7 +1093,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1062,7 +1115,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiException.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiException.java index 8e7eb0faf90..cf5905d28ec 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiException.java @@ -16,22 +16,47 @@ package org.openapitools.client; import java.util.Map; import java.util.List; +/** + *

ApiException class.

+ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + + /** + *

Constructor for ApiException.

+ */ public ApiException() {} + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ public ApiException(Throwable throwable) { super(throwable); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ public ApiException(String message) { super(message); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -39,23 +64,60 @@ public class ApiException extends Exception { this.responseBody = responseBody; } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, Map> responseHeaders, String responseBody) { this((String) null, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ public ApiException(int code, String message) { super(message); this.code = code; } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); this.responseHeaders = responseHeaders; diff --git a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiResponse.java index 7cf4cb9fdef..386fc57c438 100644 --- a/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/others/java/okhttp-gson-streaming/src/main/java/org/openapitools/client/ApiResponse.java @@ -18,8 +18,6 @@ import java.util.Map; /** * API response returned by API call. - * - * @param The type of data that is deserialized from response body */ public class ApiResponse { final private int statusCode; @@ -27,6 +25,8 @@ public class ApiResponse { final private T data; /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -35,6 +35,8 @@ public class ApiResponse { } /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -45,14 +47,29 @@ public class ApiResponse { this.data = data; } + /** + *

Get the status code.

+ * + * @return the status code + */ public int getStatusCode() { return statusCode; } + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ public Map> getHeaders() { return headers; } + /** + *

Get the data.

+ * + * @return the data + */ public T getData() { return data; } diff --git a/samples/client/petstore/cpp-restsdk/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/CMakeLists.txt index 27ceccc45fd..93dcc141b16 100644 --- a/samples/client/petstore/cpp-restsdk/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/CMakeLists.txt @@ -1,57 +1,21 @@ -cmake_minimum_required (VERSION 3.2) - -project(cpprest-petstore) -set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -if (UNIX) - message(STATUS "Building for Linux/Unix") - - set(CMAKE_BUILD_TYPE Debug) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable -pg -g3") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable -pg -g3") - - find_package(cpprestsdk REQUIRED) - find_package(Boost REQUIRED) -else() - message(STATUS "Building for Windows") - - find_package(cpprestsdk REQUIRED) - find_package(Boost REQUIRED) - find_package(pthreads REQUIRED) -endif() +cmake_minimum_required (VERSION 3.1) add_subdirectory(client) -file(GLOB SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +project(cpprest-petstore) + +find_package(Threads REQUIRED) + +file(GLOB SOURCE_FILES "*.cpp") + +add_executable(${PROJECT_NAME} ${SOURCE_FILES}) + +target_link_libraries(${PROJECT_NAME} + PRIVATE + CppRestPetstoreClient + Threads::Threads ) -add_executable(${PROJECT_NAME} ${SRCS}) -add_dependencies(${PROJECT_NAME} CppRestOpenAPIClient ) - -target_include_directories( - ${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/client - ${CMAKE_CURRENT_SOURCE_DIR}/client/model - ${CMAKE_CURRENT_SOURCE_DIR}/client/api - ${Boost_INCLUDE_DIRS} -) - -target_link_directories( - ${PROJECT_NAME} PRIVATE - ${Boost_LIBRARY_DIRS} -) - -if (UNIX) - target_link_libraries(${PROJECT_NAME} PRIVATE CppRestOpenAPIClient cpprest pthread ${Boost_LIBRARIES} crypto) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE CppRestOpenAPIClient cpprestsdk::cpprest ${pthreads_LIBRARIES} ${Boost_LIBRARIES} bcrypt) -endif() - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) - if (UNIX) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) endif() diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES index 92e7f17c960..4935b4dc57f 100644 --- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES +++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES @@ -6,6 +6,7 @@ ApiConfiguration.h ApiException.cpp ApiException.h CMakeLists.txt +Config.cmake.in HttpContent.cpp HttpContent.h IHttpBody.h diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt index 923a3f75752..cb15320268b 100644 --- a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt @@ -8,69 +8,85 @@ # # NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 3.1) -#PROJECT's NAME -project(CppRestOpenAPIClient) -set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) +project(CppRestPetstoreClient) -# THE LOCATION OF OUTPUT BINARIES -set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CXX_STANDARD_REQUIRED ON) + +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() -# BUILD TYPE -message("A ${CMAKE_BUILD_TYPE} build configuration is detected") +find_package(cpprestsdk REQUIRED) +find_package(Boost REQUIRED) + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) + +file(GLOB_RECURSE HEADER_FILES "*.h") +file(GLOB_RECURSE SOURCE_FILES "*.cpp") + +add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES}) + +target_compile_options(${PROJECT_NAME} + PRIVATE + $<$,$,$>: + -Wall -Wno-unused-variable> +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ +) + +target_link_directories(${PROJECT_NAME} + PRIVATE + ${Boost_LIBRARY_DIRS} +) if (UNIX) message(STATUS "Building client library for Linux/Unix") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable") - set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/) - - find_package(cpprestsdk REQUIRED) - find_package(Boost REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC cpprest ${Boost_LIBRARIES} crypto) else() message(STATUS "Building client library for Windows") - find_package(cpprestsdk REQUIRED) - find_package(Boost REQUIRED) + target_link_libraries(${PROJECT_NAME} PUBLIC cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt) endif() -# Manually set the cpprestsdk paths when not using package manager -#set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) -#set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) -#include_directories(${CPPREST_INCLUDE_DIR}) -#link_directories(${CPPREST_LIBRARY_DIR}) - -#SUPPORTING FILES -set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object") -#SOURCE FILES -file(GLOB SOURCE_FILES "api/*" "model/*") - -add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) - -target_include_directories( - ${PROJECT_NAME} PRIVATE - ${Boost_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/model - ${CMAKE_CURRENT_SOURCE_DIR}/api +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" ) -target_link_directories( - ${PROJECT_NAME} PRIVATE - ${Boost_LIBRARY_DIRS} +install( + TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}Targets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) -if (UNIX) - target_link_libraries(${PROJECT_NAME} PRIVATE cpprest ${Boost_LIBRARIES} crypto) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${Boost_LIBRARIES} bcrypt) -endif() +install( + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} + FILES_MATCHING PATTERN "*.h" +) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) + +install( + EXPORT ${PROJECT_NAME}Targets + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} +) diff --git a/samples/client/petstore/cpp-restsdk/client/Config.cmake.in b/samples/client/petstore/cpp-restsdk/client/Config.cmake.in new file mode 100644 index 00000000000..2a485225c0c --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/Config.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) + +check_required_components("@PROJECT_NAME@") diff --git a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h index 52d61688482..2fcd2618ed5 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h @@ -19,14 +19,13 @@ #define ORG_OPENAPITOOLS_CLIENT_API_PetApi_H_ -#include "../ApiClient.h" -#include "ApiResponse.h" +#include "ApiClient.h" + +#include "model/ApiResponse.h" #include "HttpContent.h" -#include "Pet.h" +#include "model/Pet.h" #include - - #include namespace org { diff --git a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h index 89ccea78d06..13b3ecf0e8f 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h @@ -19,13 +19,12 @@ #define ORG_OPENAPITOOLS_CLIENT_API_StoreApi_H_ -#include "../ApiClient.h" -#include "Order.h" +#include "ApiClient.h" + +#include "model/Order.h" #include #include - - #include namespace org { diff --git a/samples/client/petstore/cpp-restsdk/client/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h index 943d13757ea..b4066c66108 100644 --- a/samples/client/petstore/cpp-restsdk/client/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h @@ -19,13 +19,12 @@ #define ORG_OPENAPITOOLS_CLIENT_API_UserApi_H_ -#include "../ApiClient.h" -#include "User.h" +#include "ApiClient.h" + +#include "model/User.h" #include #include - - #include namespace org { diff --git a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h index aa992da1771..0638c6c5a8c 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h @@ -19,7 +19,7 @@ #define ORG_OPENAPITOOLS_CLIENT_MODEL_ApiResponse_H_ -#include "../ModelBase.h" +#include "ModelBase.h" #include diff --git a/samples/client/petstore/cpp-restsdk/client/model/Category.h b/samples/client/petstore/cpp-restsdk/client/model/Category.h index 7a0e66e8538..e645578d7b1 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.h @@ -19,7 +19,7 @@ #define ORG_OPENAPITOOLS_CLIENT_MODEL_Category_H_ -#include "../ModelBase.h" +#include "ModelBase.h" #include diff --git a/samples/client/petstore/cpp-restsdk/client/model/Order.h b/samples/client/petstore/cpp-restsdk/client/model/Order.h index f6fa17a75d5..72cacb25228 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.h @@ -19,7 +19,7 @@ #define ORG_OPENAPITOOLS_CLIENT_MODEL_Order_H_ -#include "../ModelBase.h" +#include "ModelBase.h" #include diff --git a/samples/client/petstore/cpp-restsdk/client/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/model/Pet.h index 581042fa91d..97a75c7700c 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.h @@ -19,12 +19,12 @@ #define ORG_OPENAPITOOLS_CLIENT_MODEL_Pet_H_ -#include "../ModelBase.h" +#include "ModelBase.h" -#include "Tag.h" +#include "model/Tag.h" #include -#include "Category.h" #include +#include "model/Category.h" namespace org { namespace openapitools { diff --git a/samples/client/petstore/cpp-restsdk/client/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/model/Tag.h index 3dac8f1f790..10cb4720454 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.h @@ -19,7 +19,7 @@ #define ORG_OPENAPITOOLS_CLIENT_MODEL_Tag_H_ -#include "../ModelBase.h" +#include "ModelBase.h" #include diff --git a/samples/client/petstore/cpp-restsdk/client/model/User.h b/samples/client/petstore/cpp-restsdk/client/model/User.h index 757a48ae8a7..5de93a21a81 100644 --- a/samples/client/petstore/cpp-restsdk/client/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/model/User.h @@ -19,7 +19,7 @@ #define ORG_OPENAPITOOLS_CLIENT_MODEL_User_H_ -#include "../ModelBase.h" +#include "ModelBase.h" #include diff --git a/samples/client/petstore/crystal/.gitignore b/samples/client/petstore/crystal/.gitignore index 05a17cb8f0a..1a7e69fd1cd 100644 --- a/samples/client/petstore/crystal/.gitignore +++ b/samples/client/petstore/crystal/.gitignore @@ -1,39 +1,14 @@ # Generated by: https://openapi-generator.tech # -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/spec/examples.txt -/test/tmp/ -/test/version_tmp/ +/docs/ +/lib/ +/bin/ +/.shards/ +*.dwarf + +# Libraries don't need dependency lock +# Dependencies will be locked in applications that use them +/shard.lock + /tmp/ - -## Specific to RubyMotion: -.dat* -.repl_history -build/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalization: -/.bundle/ -/vendor/bundle -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc diff --git a/samples/client/petstore/crystal/.rspec b/samples/client/petstore/crystal/.rspec deleted file mode 100644 index 83e16f80447..00000000000 --- a/samples/client/petstore/crystal/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---require spec_helper diff --git a/samples/client/petstore/crystal/.rubocop.yml b/samples/client/petstore/crystal/.rubocop.yml deleted file mode 100644 index d32b2b1cdab..00000000000 --- a/samples/client/petstore/crystal/.rubocop.yml +++ /dev/null @@ -1,148 +0,0 @@ -# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) -# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) -AllCops: - TargetRubyVersion: 2.4 - # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop - # to ignore them, so only the ones explicitly set in this file are enabled. - DisabledByDefault: true - Exclude: - - '**/templates/**/*' - - '**/vendor/**/*' - - 'actionpack/lib/action_dispatch/journey/parser.rb' - -# Prefer &&/|| over and/or. -Style/AndOr: - Enabled: true - -# Align `when` with `case`. -Layout/CaseIndentation: - Enabled: true - -# Align comments with method definitions. -Layout/CommentIndentation: - Enabled: true - -Layout/ElseAlignment: - Enabled: true - -Layout/EmptyLineAfterMagicComment: - Enabled: true - -# In a regular class definition, no empty lines around the body. -Layout/EmptyLinesAroundClassBody: - Enabled: true - -# In a regular method definition, no empty lines around the body. -Layout/EmptyLinesAroundMethodBody: - Enabled: true - -# In a regular module definition, no empty lines around the body. -Layout/EmptyLinesAroundModuleBody: - Enabled: true - -Layout/FirstArgumentIndentation: - Enabled: true - -# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. -Style/HashSyntax: - Enabled: false - -# Method definitions after `private` or `protected` isolated calls need one -# extra level of indentation. -Layout/IndentationConsistency: - Enabled: true - EnforcedStyle: indented_internal_methods - -# Two spaces, no tabs (for indentation). -Layout/IndentationWidth: - Enabled: true - -Layout/LeadingCommentSpace: - Enabled: true - -Layout/SpaceAfterColon: - Enabled: true - -Layout/SpaceAfterComma: - Enabled: true - -Layout/SpaceAroundEqualsInParameterDefault: - Enabled: true - -Layout/SpaceAroundKeyword: - Enabled: true - -Layout/SpaceAroundOperators: - Enabled: true - -Layout/SpaceBeforeComma: - Enabled: true - -Layout/SpaceBeforeFirstArg: - Enabled: true - -Style/DefWithParentheses: - Enabled: true - -# Defining a method with parameters needs parentheses. -Style/MethodDefParentheses: - Enabled: true - -Style/FrozenStringLiteralComment: - Enabled: false - EnforcedStyle: always - -# Use `foo {}` not `foo{}`. -Layout/SpaceBeforeBlockBraces: - Enabled: true - -# Use `foo { bar }` not `foo {bar}`. -Layout/SpaceInsideBlockBraces: - Enabled: true - -# Use `{ a: 1 }` not `{a:1}`. -Layout/SpaceInsideHashLiteralBraces: - Enabled: true - -Layout/SpaceInsideParens: - Enabled: true - -# Check quotes usage according to lint rule below. -#Style/StringLiterals: -# Enabled: true -# EnforcedStyle: single_quotes - -# Detect hard tabs, no hard tabs. -Layout/IndentationStyle: - Enabled: true - -# Blank lines should not have any spaces. -Layout/TrailingEmptyLines: - Enabled: true - -# No trailing whitespace. -Layout/TrailingWhitespace: - Enabled: false - -# Use quotes for string literals when they are enough. -Style/RedundantPercentQ: - Enabled: true - -# Align `end` with the matching keyword or starting expression except for -# assignments, where it should be aligned with the LHS. -Layout/EndAlignment: - Enabled: true - EnforcedStyleAlignWith: variable - AutoCorrect: true - -# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. -Lint/RequireParentheses: - Enabled: true - -Style/RedundantReturn: - Enabled: true - AllowMultipleReturnValues: true - -Style/Semicolon: - Enabled: true - AllowAsExpressionSeparator: true diff --git a/samples/client/petstore/java/feign-no-nullable/build.gradle b/samples/client/petstore/java/feign-no-nullable/build.gradle index e8630f875ec..2231ca517ba 100644 --- a/samples/client/petstore/java/feign-no-nullable/build.gradle +++ b/samples/client/petstore/java/feign-no-nullable/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-feign-no-nullable' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-feign-no-nullable' + from components.java + } } } diff --git a/samples/client/petstore/java/feign-no-nullable/gradlew b/samples/client/petstore/java/feign-no-nullable/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index 6a9e84819fc..8cbc10e5c13 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-feign' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-feign' + from components.java + } } } diff --git a/samples/client/petstore/java/feign/feign10x/build.gradle b/samples/client/petstore/java/feign/feign10x/build.gradle index 68f46df20fd..e934a53d289 100644 --- a/samples/client/petstore/java/feign/feign10x/build.gradle +++ b/samples/client/petstore/java/feign/feign10x/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,18 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-feign-10x' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-feign-10x' + + from components.java + } } } @@ -107,19 +110,19 @@ ext { } dependencies { - compile "io.swagger:swagger-annotations:$swagger_annotations_version" - compile "com.google.code.findbugs:jsr305:3.0.2" - compile "io.github.openfeign:feign-core:$feign_version" - compile "io.github.openfeign:feign-jackson:$feign_version" - compile "io.github.openfeign:feign-slf4j:$feign_version" - compile "io.github.openfeign.form:feign-form:$feign_form_version" - compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" - compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" - compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" - compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" - compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" - compile "com.brsanthu:migbase64:2.2" - compile 'javax.annotation:javax.annotation-api:1.3.2' - testCompile "junit:junit:$junit_version" + compileOnly "io.swagger:swagger-annotations:$swagger_annotations_version" + compileOnly "com.google.code.findbugs:jsr305:3.0.2" + compileOnly "io.github.openfeign:feign-core:$feign_version" + compileOnly "io.github.openfeign:feign-jackson:$feign_version" + compileOnly "io.github.openfeign:feign-slf4j:$feign_version" + compileOnly "io.github.openfeign.form:feign-form:$feign_form_version" + compileOnly "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compileOnly "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compileOnly "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" + compileOnly "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" + compileOnly "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threetenbp_version" + compileOnly "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compileOnly "com.brsanthu:migbase64:2.2" + compileOnly 'javax.annotation:javax.annotation-api:1.3.2' + testCompileOnly "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.jar index cc4fdc293d0..7454180f2ae 100644 Binary files a/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.properties index 94920145f34..ffed3a254e9 100644 --- a/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/java/feign/feign10x/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/java/feign/feign10x/gradlew b/samples/client/petstore/java/feign/feign10x/gradlew old mode 100644 new mode 100755 index 2fe81a7d95e..1b6c787337f --- a/samples/client/petstore/java/feign/feign10x/gradlew +++ b/samples/client/petstore/java/feign/feign10x/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,78 +17,113 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -105,79 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/java/feign/feign10x/gradlew.bat b/samples/client/petstore/java/feign/feign10x/gradlew.bat index 9618d8d9607..107acd32c4e 100644 --- a/samples/client/petstore/java/feign/feign10x/gradlew.bat +++ b/samples/client/petstore/java/feign/feign10x/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/samples/client/petstore/java/feign/gradlew b/samples/client/petstore/java/feign/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/google-api-client/build.gradle b/samples/client/petstore/java/google-api-client/build.gradle index 39ed02a1cd4..6b3f54f8166 100644 --- a/samples/client/petstore/java/google-api-client/build.gradle +++ b/samples/client/petstore/java/google-api-client/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-google-api-client' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-google-api-client' + from components.java + } } } diff --git a/samples/client/petstore/java/google-api-client/gradlew b/samples/client/petstore/java/google-api-client/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle index 346045b3e5d..40621886ce3 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.gradle @@ -103,7 +103,7 @@ ext { jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" - scribejava_apis_version = "6.9.0" + scribejava_apis_version = "8.3.1" } dependencies { diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt b/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt index aacd11922c9..a5e716d7c18 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/build.sbt @@ -21,7 +21,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", - "com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile", + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml b/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml index fe5cc8b2cce..8a771818fa1 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/pom.xml @@ -36,7 +36,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -84,16 +84,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.2.0 - jar test-jar @@ -101,11 +99,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -138,8 +135,8 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 1.8 + 1.8 true 128m 512m @@ -152,7 +149,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -163,7 +160,7 @@ none - 1.8 + 1.8 http.response.details @@ -176,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -308,6 +305,6 @@ 0.2.1 1.3.5 4.13.2 - 6.9.0 + 8.3.1 diff --git a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java index 69a73213d8e..88345206919 100644 --- a/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey2-java8-localdatetime/src/main/java/org/openapitools/client/JSON.java @@ -2,6 +2,7 @@ package org.openapitools.client; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.openapitools.client.model.*; @@ -21,7 +22,7 @@ public class JSON implements ContextResolver { public JSON() { mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index cdefe2ed3cb..9cf958ea4ed 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -103,7 +103,7 @@ ext { jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" - scribejava_apis_version = "6.9.0" + scribejava_apis_version = "8.3.1" } dependencies { diff --git a/samples/client/petstore/java/jersey2-java8/build.sbt b/samples/client/petstore/java/jersey2-java8/build.sbt index db7f6feb2ef..424fe3d4581 100644 --- a/samples/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/client/petstore/java/jersey2-java8/build.sbt @@ -21,7 +21,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", - "com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile", + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", "com.novocode" % "junit-interface" % "0.10" % "test" diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index 114bc87e72c..5fb184b6803 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -36,7 +36,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -84,16 +84,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.2.0 - jar test-jar @@ -101,11 +99,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -138,8 +135,8 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 1.8 + 1.8 true 128m 512m @@ -152,7 +149,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -163,7 +160,7 @@ none - 1.8 + 1.8 http.response.details @@ -176,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -308,6 +305,6 @@ 0.2.1 1.3.5 4.13.2 - 6.9.0 + 8.3.1 diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java index 69a73213d8e..88345206919 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java @@ -2,6 +2,7 @@ package org.openapitools.client; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.openapitools.client.model.*; @@ -21,7 +22,7 @@ public class JSON implements ContextResolver { public JSON() { mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); diff --git a/samples/client/petstore/java/microprofile-rest-client/pom.xml b/samples/client/petstore/java/microprofile-rest-client/pom.xml index 39b65989001..2050156fe40 100644 --- a/samples/client/petstore/java/microprofile-rest-client/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client/pom.xml @@ -66,7 +66,7 @@ org.eclipse.microprofile.rest.client microprofile-rest-client-api - 1.2.1 + 1.4.1 @@ -157,7 +157,7 @@ 1.2.0 3.2.7 2.9.7 - 1.2.2 + 1.2.2 1.3.5 1.0.2 1.1.6 diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java index 01f075d1cc0..3d2ecd955a5 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/PetApi.java @@ -36,7 +36,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; * */ -@RegisterRestClient +@RegisterRestClient(configKey="petstore") @RegisterProvider(ApiExceptionMapper.class) @Path("/pet") public interface PetApi { diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java index 4e5844e79ad..fc5b9b52f29 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/StoreApi.java @@ -34,7 +34,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; * */ -@RegisterRestClient +@RegisterRestClient(configKey="petstore") @RegisterProvider(ApiExceptionMapper.class) @Path("/store") public interface StoreApi { diff --git a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java index 41c31a4d49d..b9fd9ed12a0 100644 --- a/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/microprofile-rest-client/src/main/java/org/openapitools/client/api/UserApi.java @@ -34,7 +34,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; * */ -@RegisterRestClient +@RegisterRestClient(configKey="petstore") @RegisterProvider(ApiExceptionMapper.class) @Path("/user") public interface UserApi { diff --git a/samples/client/petstore/java/native-async/build.gradle b/samples/client/petstore/java/native-async/build.gradle index 6bebeffcdd4..916539c686b 100644 --- a/samples/client/petstore/java/native-async/build.gradle +++ b/samples/client/petstore/java/native-async/build.gradle @@ -6,18 +6,16 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -33,9 +31,12 @@ javadoc { options.encoding = 'UTF-8' } -install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-native' +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-native' + from components.java + } } } diff --git a/samples/client/petstore/java/native-async/gradlew b/samples/client/petstore/java/native-async/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/native/build.gradle b/samples/client/petstore/java/native/build.gradle index 6bebeffcdd4..916539c686b 100644 --- a/samples/client/petstore/java/native/build.gradle +++ b/samples/client/petstore/java/native/build.gradle @@ -6,18 +6,16 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -33,9 +31,12 @@ javadoc { options.encoding = 'UTF-8' } -install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-native' +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-native' + from components.java + } } } diff --git a/samples/client/petstore/java/native/gradlew b/samples/client/petstore/java/native/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md b/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md index b45b974dee3..c25c1a39c47 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: 1. Java 1.7+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -49,7 +49,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-okhttp-gson-dynamicoperations:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-gson-dynamicoperations' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-gson-dynamicoperations' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-gson-dynamicoperations:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml b/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml index 169961f2e35..3ce94aa5dd4 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/pom.xml @@ -50,7 +50,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -97,16 +97,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.2.0 - jar test-jar @@ -114,11 +112,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -149,7 +146,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -172,7 +169,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -193,7 +190,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -259,7 +256,7 @@ io.swagger.parser.v3 swagger-parser-v3 - 2.0.23 + 2.0.28 jakarta.annotation @@ -282,23 +279,23 @@ org.mockito mockito-core - 3.11.2 + 3.12.4 test - 1.7 + 1.8 ${java.version} ${java.version} 1.8.5 - 1.6.2 - 4.9.1 - 2.8.6 - 3.11 + 1.6.3 + 4.9.2 + 2.8.8 + 3.12.0 0.2.1 1.5.0 1.3.5 - 4.13.1 + 4.13.2 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java index 61640a5f128..cf6e97422ab 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiClient.java @@ -65,6 +65,9 @@ import org.openapitools.client.auth.OAuth; import org.openapitools.client.auth.RetryingOAuth; import org.openapitools.client.auth.OAuthFlow; +/** + *

ApiClient class.

+ */ public class ApiClient { private String basePath = "http://petstore.swagger.io:80/v2"; @@ -91,7 +94,7 @@ public class ApiClient { private Map operationLookupMap = new HashMap<>(); - /* + /** * Basic constructor for ApiClient */ public ApiClient() { @@ -107,8 +110,10 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object */ public ApiClient(OkHttpClient client) { init(); @@ -124,28 +129,28 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID */ public ApiClient(String clientId) { this(clientId, null, null); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters */ public ApiClient(String clientId, Map parameters) { this(clientId, null, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters */ public ApiClient(String clientId, String clientSecret, Map parameters) { this(null, clientId, clientSecret, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters */ public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { @@ -241,7 +246,7 @@ public class ApiClient { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -313,6 +318,11 @@ public class ApiClient { return this; } + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ public KeyManager[] getKeyManagers() { return keyManagers; } @@ -330,30 +340,65 @@ public class ApiClient { return this; } + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ public DateFormat getDateFormat() { return dateFormat; } + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setDateFormat(DateFormat dateFormat) { this.json.setDateFormat(dateFormat); return this; } + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; } + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setOffsetDateTimeFormat(dateFormat); return this; } + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); return this; } + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLenientOnJson(boolean lenientOnJson) { this.json.setLenientOnJson(lenientOnJson); return this; @@ -556,7 +601,7 @@ public class ApiClient { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -578,7 +623,7 @@ public class ApiClient { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -600,7 +645,7 @@ public class ApiClient { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -836,7 +881,7 @@ public class ApiClient { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -897,7 +942,7 @@ public class ApiClient { * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws org.openapitools.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -923,7 +968,7 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -943,7 +988,7 @@ public class ApiClient { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -987,7 +1032,7 @@ public class ApiClient { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1002,7 +1047,7 @@ public class ApiClient { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1066,7 +1111,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1112,7 +1157,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1134,7 +1179,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java index c814fc5bbc9..bd303bed5f9 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiException.java @@ -16,22 +16,47 @@ package org.openapitools.client; import java.util.Map; import java.util.List; +/** + *

ApiException class.

+ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + + /** + *

Constructor for ApiException.

+ */ public ApiException() {} + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ public ApiException(Throwable throwable) { super(throwable); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ public ApiException(String message) { super(message); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -39,23 +64,60 @@ public class ApiException extends Exception { this.responseBody = responseBody; } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, Map> responseHeaders, String responseBody) { this((String) null, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ public ApiException(int code, String message) { super(message); this.code = code; } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); this.responseHeaders = responseHeaders; diff --git a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java index 9bb5cac17b4..fb13945bd77 100644 --- a/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-dynamicOperations/src/main/java/org/openapitools/client/ApiResponse.java @@ -18,8 +18,6 @@ import java.util.Map; /** * API response returned by API call. - * - * @param The type of data that is deserialized from response body */ public class ApiResponse { final private int statusCode; @@ -27,6 +25,8 @@ public class ApiResponse { final private T data; /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -35,6 +35,8 @@ public class ApiResponse { } /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -45,14 +47,29 @@ public class ApiResponse { this.data = data; } + /** + *

Get the status code.

+ * + * @return the status code + */ public int getStatusCode() { return statusCode; } + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ public Map> getHeaders() { return headers; } + /** + *

Get the data.

+ * + * @return the data + */ public T getData() { return data; } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md index 906bc302af8..40458ad8a74 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: 1. Java 1.7+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -49,7 +49,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-okhttp-gson-parcelableModel:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-gson-parcelableModel' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-gson-parcelableModel' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-gson-parcelableModel:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index cbded0cff24..3235bef8854 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -50,7 +50,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -97,16 +97,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.2.0 - jar test-jar @@ -114,11 +112,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -149,7 +146,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -172,7 +169,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -193,7 +190,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -284,23 +281,23 @@ org.mockito mockito-core - 3.11.2 + 3.12.4 test - 1.7 + 1.8 ${java.version} ${java.version} 1.8.5 - 1.6.2 - 4.9.1 - 2.8.6 - 3.11 + 1.6.3 + 4.9.2 + 2.8.8 + 3.12.0 0.2.1 1.5.0 1.3.5 - 4.13.1 + 4.13.2 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index 56e5bffc6bb..5cb69f9640b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -59,6 +59,9 @@ import org.openapitools.client.auth.OAuth; import org.openapitools.client.auth.RetryingOAuth; import org.openapitools.client.auth.OAuthFlow; +/** + *

ApiClient class.

+ */ public class ApiClient { private String basePath = "http://petstore.swagger.io:80/v2"; @@ -83,7 +86,7 @@ public class ApiClient { private HttpLoggingInterceptor loggingInterceptor; - /* + /** * Basic constructor for ApiClient */ public ApiClient() { @@ -99,8 +102,10 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object */ public ApiClient(OkHttpClient client) { init(); @@ -116,28 +121,28 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID */ public ApiClient(String clientId) { this(clientId, null, null); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters */ public ApiClient(String clientId, Map parameters) { this(clientId, null, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters */ public ApiClient(String clientId, String clientSecret, Map parameters) { this(null, clientId, clientSecret, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters */ public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { @@ -230,7 +235,7 @@ public class ApiClient { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -302,6 +307,11 @@ public class ApiClient { return this; } + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ public KeyManager[] getKeyManagers() { return keyManagers; } @@ -319,30 +329,65 @@ public class ApiClient { return this; } + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ public DateFormat getDateFormat() { return dateFormat; } + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setDateFormat(DateFormat dateFormat) { this.json.setDateFormat(dateFormat); return this; } + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; } + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setOffsetDateTimeFormat(dateFormat); return this; } + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); return this; } + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLenientOnJson(boolean lenientOnJson) { this.json.setLenientOnJson(lenientOnJson); return this; @@ -545,7 +590,7 @@ public class ApiClient { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -567,7 +612,7 @@ public class ApiClient { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -589,7 +634,7 @@ public class ApiClient { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -837,7 +882,7 @@ public class ApiClient { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -898,7 +943,7 @@ public class ApiClient { * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws org.openapitools.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -924,7 +969,7 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -944,7 +989,7 @@ public class ApiClient { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -988,7 +1033,7 @@ public class ApiClient { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1003,7 +1048,7 @@ public class ApiClient { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1067,7 +1112,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1113,7 +1158,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1135,7 +1180,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiException.java index c814fc5bbc9..bd303bed5f9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiException.java @@ -16,22 +16,47 @@ package org.openapitools.client; import java.util.Map; import java.util.List; +/** + *

ApiException class.

+ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + + /** + *

Constructor for ApiException.

+ */ public ApiException() {} + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ public ApiException(Throwable throwable) { super(throwable); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ public ApiException(String message) { super(message); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -39,23 +64,60 @@ public class ApiException extends Exception { this.responseBody = responseBody; } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, Map> responseHeaders, String responseBody) { this((String) null, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ public ApiException(int code, String message) { super(message); this.code = code; } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); this.responseHeaders = responseHeaders; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java index 9bb5cac17b4..fb13945bd77 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiResponse.java @@ -18,8 +18,6 @@ import java.util.Map; /** * API response returned by API call. - * - * @param The type of data that is deserialized from response body */ public class ApiResponse { final private int statusCode; @@ -27,6 +25,8 @@ public class ApiResponse { final private T data; /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -35,6 +35,8 @@ public class ApiResponse { } /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -45,14 +47,29 @@ public class ApiResponse { this.data = data; } + /** + *

Get the status code.

+ * + * @return the status code + */ public int getStatusCode() { return statusCode; } + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ public Map> getHeaders() { return headers; } + /** + *

Get the data.

+ * + * @return the data + */ public T getData() { return data; } diff --git a/samples/client/petstore/java/okhttp-gson/README.md b/samples/client/petstore/java/okhttp-gson/README.md index 516d98bed0a..8a02b7818b8 100644 --- a/samples/client/petstore/java/okhttp-gson/README.md +++ b/samples/client/petstore/java/okhttp-gson/README.md @@ -13,7 +13,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod Building the API client library requires: 1. Java 1.7+ -2. Maven/Gradle +2. Maven (3.8.3+)/Gradle (7.2+) ## Installation @@ -49,7 +49,14 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -compile "org.openapitools:petstore-okhttp-gson:1.0.0" + repositories { + mavenCentral() // Needed if the 'petstore-okhttp-gson' jar has been published to maven central. + mavenLocal() // Needed if the 'petstore-okhttp-gson' jar has been published to the local maven repo. + } + + dependencies { + implementation "org.openapitools:petstore-okhttp-gson:1.0.0" + } ``` ### Others diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 7406e439fd1..f3c9b191c95 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -50,7 +50,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -70,7 +70,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -97,16 +97,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.2 + 3.2.0 - jar test-jar @@ -114,11 +112,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -149,7 +146,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -172,7 +169,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -193,7 +190,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts @@ -277,23 +274,23 @@ org.mockito mockito-core - 3.11.2 + 3.12.4 test - 1.7 + 1.8 ${java.version} ${java.version} 1.8.5 - 1.6.2 - 4.9.1 - 2.8.6 - 3.11 + 1.6.3 + 4.9.2 + 2.8.8 + 3.12.0 0.2.1 1.5.0 1.3.5 - 4.13.1 + 4.13.2 UTF-8 diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index 56e5bffc6bb..5cb69f9640b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -59,6 +59,9 @@ import org.openapitools.client.auth.OAuth; import org.openapitools.client.auth.RetryingOAuth; import org.openapitools.client.auth.OAuthFlow; +/** + *

ApiClient class.

+ */ public class ApiClient { private String basePath = "http://petstore.swagger.io:80/v2"; @@ -83,7 +86,7 @@ public class ApiClient { private HttpLoggingInterceptor loggingInterceptor; - /* + /** * Basic constructor for ApiClient */ public ApiClient() { @@ -99,8 +102,10 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object */ public ApiClient(OkHttpClient client) { init(); @@ -116,28 +121,28 @@ public class ApiClient { authentications = Collections.unmodifiableMap(authentications); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID */ public ApiClient(String clientId) { this(clientId, null, null); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID and additional parameters */ public ApiClient(String clientId, Map parameters) { this(clientId, null, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with client ID, secret, and additional parameters */ public ApiClient(String clientId, String clientSecret, Map parameters) { this(null, clientId, clientSecret, parameters); } - /* + /** * Constructor for ApiClient to support access token retry on 401/403 configured with base path, client ID, secret, and additional parameters */ public ApiClient(String basePath, String clientId, String clientSecret, Map parameters) { @@ -230,7 +235,7 @@ public class ApiClient { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -302,6 +307,11 @@ public class ApiClient { return this; } + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ public KeyManager[] getKeyManagers() { return keyManagers; } @@ -319,30 +329,65 @@ public class ApiClient { return this; } + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ public DateFormat getDateFormat() { return dateFormat; } + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setDateFormat(DateFormat dateFormat) { this.json.setDateFormat(dateFormat); return this; } + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { this.json.setSqlDateFormat(dateFormat); return this; } + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { this.json.setOffsetDateTimeFormat(dateFormat); return this; } + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link org.threeten.bp.format.DateTimeFormatter} object + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { this.json.setLocalDateFormat(dateFormat); return this; } + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link org.openapitools.client.ApiClient} object + */ public ApiClient setLenientOnJson(boolean lenientOnJson) { this.json.setLenientOnJson(lenientOnJson); return this; @@ -545,7 +590,7 @@ public class ApiClient { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -567,7 +612,7 @@ public class ApiClient { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -589,7 +634,7 @@ public class ApiClient { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -837,7 +882,7 @@ public class ApiClient { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -898,7 +943,7 @@ public class ApiClient { * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws org.openapitools.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -924,7 +969,7 @@ public class ApiClient { * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -944,7 +989,7 @@ public class ApiClient { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -988,7 +1033,7 @@ public class ApiClient { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1003,7 +1048,7 @@ public class ApiClient { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws org.openapitools.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1067,7 +1112,7 @@ public class ApiClient { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1113,7 +1158,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1135,7 +1180,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws ApiException If fail to serialize the request body object + * @throws org.openapitools.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiException.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiException.java index c814fc5bbc9..bd303bed5f9 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiException.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiException.java @@ -16,22 +16,47 @@ package org.openapitools.client; import java.util.Map; import java.util.List; +/** + *

ApiException class.

+ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; private String responseBody = null; - + + /** + *

Constructor for ApiException.

+ */ public ApiException() {} + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ public ApiException(Throwable throwable) { super(throwable); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ public ApiException(String message) { super(message); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -39,23 +64,60 @@ public class ApiException extends Exception { this.responseBody = responseBody; } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, Map> responseHeaders, String responseBody) { this((String) null, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ public ApiException(int code, String message) { super(message); this.code = code; } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); this.responseHeaders = responseHeaders; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiResponse.java index 9bb5cac17b4..fb13945bd77 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiResponse.java @@ -18,8 +18,6 @@ import java.util.Map; /** * API response returned by API call. - * - * @param The type of data that is deserialized from response body */ public class ApiResponse { final private int statusCode; @@ -27,6 +25,8 @@ public class ApiResponse { final private T data; /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -35,6 +35,8 @@ public class ApiResponse { } /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -45,14 +47,29 @@ public class ApiResponse { this.data = data; } + /** + *

Get the status code.

+ * + * @return the status code + */ public int getStatusCode() { return statusCode; } + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ public Map> getHeaders() { return headers; } + /** + *

Get the data.

+ * + * @return the data + */ public T getData() { return data; } diff --git a/samples/client/petstore/java/rest-assured-jackson/build.gradle b/samples/client/petstore/java/rest-assured-jackson/build.gradle index 126452afdc1..e99cf39b119 100644 --- a/samples/client/petstore/java/rest-assured-jackson/build.gradle +++ b/samples/client/petstore/java/rest-assured-jackson/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-rest-assured-jackson' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-rest-assured-jackson' + from components.java + } } } diff --git a/samples/client/petstore/java/rest-assured-jackson/gradlew b/samples/client/petstore/java/rest-assured-jackson/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/rest-assured/build.gradle b/samples/client/petstore/java/rest-assured/build.gradle index 928f5dd4918..2c13b6f32cb 100644 --- a/samples/client/petstore/java/rest-assured/build.gradle +++ b/samples/client/petstore/java/rest-assured/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-rest-assured' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-rest-assured' + from components.java + } } } diff --git a/samples/client/petstore/java/rest-assured/gradlew b/samples/client/petstore/java/rest-assured/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/resteasy/build.gradle b/samples/client/petstore/java/resteasy/build.gradle index 49838b21fe2..c794b8613ba 100644 --- a/samples/client/petstore/java/resteasy/build.gradle +++ b/samples/client/petstore/java/resteasy/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,13 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' + sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-resteasy' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-resteasy' + from components.java + } } } diff --git a/samples/client/petstore/java/resteasy/gradlew b/samples/client/petstore/java/resteasy/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index 7e3a6d9dd83..f07930b7b5d 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-resttemplate-withxml' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-resttemplate-withxml' + from components.java + } } } diff --git a/samples/client/petstore/java/resttemplate-withXml/gradlew b/samples/client/petstore/java/resttemplate-withXml/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index d5e355df064..a5719c67de5 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-resttemplate' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-resttemplate' + from components.java + } } } diff --git a/samples/client/petstore/java/resttemplate/gradlew b/samples/client/petstore/java/resttemplate/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/retrofit2-play26/build.gradle b/samples/client/petstore/java/retrofit2-play26/build.gradle index eb0580bd8c2..a34a4271847 100644 --- a/samples/client/petstore/java/retrofit2-play26/build.gradle +++ b/samples/client/petstore/java/retrofit2-play26/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-java-client-retrofit2-play26' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-java-client-retrofit2-play26' + from components.java + } } } diff --git a/samples/client/petstore/java/retrofit2-play26/gradlew b/samples/client/petstore/java/retrofit2-play26/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index 4dafb81ae67..8a5e2ab91c4 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-retrofit2' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-retrofit2' + from components.java + } } } diff --git a/samples/client/petstore/java/retrofit2/gradlew b/samples/client/petstore/java/retrofit2/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/retrofit2rx2/build.gradle b/samples/client/petstore/java/retrofit2rx2/build.gradle index 4c801b8e23d..3fe39eddae0 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.gradle +++ b/samples/client/petstore/java/retrofit2rx2/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-retrofit2-rx2' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-retrofit2-rx2' + from components.java + } } } diff --git a/samples/client/petstore/java/retrofit2rx2/gradlew b/samples/client/petstore/java/retrofit2rx2/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/retrofit2rx3/build.gradle b/samples/client/petstore/java/retrofit2rx3/build.gradle index 96760ecfecc..c1ed0c63156 100644 --- a/samples/client/petstore/java/retrofit2rx3/build.gradle +++ b/samples/client/petstore/java/retrofit2rx3/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-retrofit2-rx3' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-retrofit2-rx3' + from components.java + } } } diff --git a/samples/client/petstore/java/retrofit2rx3/gradlew b/samples/client/petstore/java/retrofit2rx3/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/vertx-no-nullable/build.gradle b/samples/client/petstore/java/vertx-no-nullable/build.gradle index ef71d28b690..220dccd2c31 100644 --- a/samples/client/petstore/java/vertx-no-nullable/build.gradle +++ b/samples/client/petstore/java/vertx-no-nullable/build.gradle @@ -5,19 +5,21 @@ group = 'org.openapitools' version = '1.0.0' repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 -install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-vertx-no-nullable' +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-vertx-no-nullable' + from components.java + } } } diff --git a/samples/client/petstore/java/vertx-no-nullable/gradlew b/samples/client/petstore/java/vertx-no-nullable/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/vertx/build.gradle b/samples/client/petstore/java/vertx/build.gradle index 7d499745c83..c067ccdc2ad 100644 --- a/samples/client/petstore/java/vertx/build.gradle +++ b/samples/client/petstore/java/vertx/build.gradle @@ -5,19 +5,21 @@ group = 'org.openapitools' version = '1.0.0' repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 -install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-vertx' +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-vertx' + from components.java + } } } diff --git a/samples/client/petstore/java/vertx/gradlew b/samples/client/petstore/java/vertx/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/webclient-nulable-arrays/build.gradle b/samples/client/petstore/java/webclient-nulable-arrays/build.gradle index 686f85f5ace..6cbf60d744c 100644 --- a/samples/client/petstore/java/webclient-nulable-arrays/build.gradle +++ b/samples/client/petstore/java/webclient-nulable-arrays/build.gradle @@ -6,8 +6,7 @@ version = 'v1' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,8 +15,7 @@ buildscript { } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } if(hasProperty('target') && target == 'android') { @@ -78,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-webclient-nullable-arrays' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-webclient-nullable-arrays' + from components.java + } } } diff --git a/samples/client/petstore/java/webclient-nulable-arrays/gradlew b/samples/client/petstore/java/webclient-nulable-arrays/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/java/webclient/build.gradle b/samples/client/petstore/java/webclient/build.gradle index eb34d7a99cc..4d1f7d9b7f4 100644 --- a/samples/client/petstore/java/webclient/build.gradle +++ b/samples/client/petstore/java/webclient/build.gradle @@ -6,8 +6,7 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:2.3.+' @@ -16,8 +15,7 @@ buildscript { } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } if(hasProperty('target') && target == 'android') { @@ -78,14 +76,17 @@ if(hasProperty('target') && target == 'android') { } else { apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 - install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-webclient' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-webclient' + from components.java + } } } diff --git a/samples/client/petstore/java/webclient/gradlew b/samples/client/petstore/java/webclient/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 index 6329693a91f..2860418807d 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 +++ b/samples/client/petstore/powershell/src/PSPetstore/PSPetstore.psd1 @@ -3,7 +3,7 @@ # # Generated by: OpenAPI Generator Team # -# Generated on: 30-11-2020 +# Generated on: 10/30/2021 # @{ @@ -45,7 +45,7 @@ PowerShellVersion = '5.0' # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# CLRVersion = '' +# ClrVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' @@ -128,6 +128,15 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = 'This is a sample project' + # Prerelease string of this module + # Prerelease = '' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + } # End of PSData hashtable } # End of PrivateData hashtable diff --git a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 index aacf6f6d0d1..11745f18614 100644 --- a/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 +++ b/samples/client/petstore/powershell/src/PSPetstore/Private/PSApiClient.ps1 @@ -62,9 +62,15 @@ function Invoke-PSApiClient { $HeaderParameters['Accept'] = $Accept } + [string]$MultiPartBoundary = $null $ContentType= SelectHeaders -Headers $ContentTypes if ($ContentType) { $HeaderParameters['Content-Type'] = $ContentType + if ($ContentType -eq 'multipart/form-data') { + [string]$MultiPartBoundary = [System.Guid]::NewGuid() + $MultiPartBoundary = "---------------------------$MultiPartBoundary" + $HeaderParameters['Content-Type'] = "$ContentType; boundary=$MultiPartBoundary" + } } # add default headers if any @@ -72,7 +78,6 @@ function Invoke-PSApiClient { $HeaderParameters[$header.Name] = $header.Value } - # construct URL query string $HttpValues = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) foreach ($Parameter in $QueryParameters.GetEnumerator()) { @@ -90,9 +95,34 @@ function Invoke-PSApiClient { # include form parameters in the request body if ($FormParameters -and $FormParameters.Count -gt 0) { - $RequestBody = $FormParameters + if (![string]::IsNullOrEmpty($MultiPartBoundary)) { + $RequestBody = "" + $LF = "`r`n" + $FormParameters.Keys | ForEach-Object { + $value = $FormParameters[$_] + $isFile = $value.GetType().FullName -eq "System.IO.FileInfo" + + $RequestBody += "--$MultiPartBoundary$LF" + $RequestBody += "Content-Disposition: form-data; name=`"$_`"" + if ($isFile) { + $fileName = $value.Name + $RequestBody += "; filename=`"$fileName`"$LF" + $RequestBody += "Content-Type: application/octet-stream$LF$LF" + $RequestBody += Get-Content -Path $value.FullName + } else { + $RequestBody += "$LF$LF" + $RequestBody += ([string]$value) + } + $RequestBody += "$LF--$MultiPartBoundary" + } + $RequestBody += "--" + } else { + $RequestBody = $FormParameters + } } + + if ($Body -or $IsBodyNullable) { $RequestBody = $Body if ([string]::IsNullOrEmpty($RequestBody) -and $IsBodyNullable -eq $true) { diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 8fc4edbf89a..e6e4596df11 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -215,6 +215,9 @@ conf = petstore_api.Configuration( self.proxy = None """Proxy URL """ + self.no_proxy = None + """bypass proxy for host in the no_proxy list. + """ self.proxy_headers = None """Proxy headers """ diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index a38fcec1c84..476138a6bc8 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -14,8 +14,10 @@ import logging import re import ssl from urllib.parse import urlencode - +from urllib.parse import urlparse +from urllib.request import proxy_bypass_environment import urllib3 +import ipaddress from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError @@ -72,7 +74,7 @@ class RESTClientObject(object): maxsize = 4 # https pool manager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): self.pool_manager = urllib3.ProxyManager( num_pools=pools_size, maxsize=maxsize, @@ -290,3 +292,55 @@ class RESTClientObject(object): _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) + +# end of class RESTClientObject +def is_ipv4(target): + """ Test if IPv4 address or not + """ + try: + chk = ipaddress.IPv4Address(target) + return True + except ipaddress.AddressValueError: + return False + +def in_ipv4net(target, net): + """ Test if target belongs to given IPv4 network + """ + try: + nw = ipaddress.IPv4Network(net) + ip = ipaddress.IPv4Address(target) + if ip in nw: + return True + return False + except ipaddress.AddressValueError: + return False + except ipaddress.NetmaskValueError: + return False + +def should_bypass_proxies(url, no_proxy=None): + """ Yet another requests.should_bypass_proxies + Test if proxies should not be used for a particular url. + """ + + parsed = urlparse(url) + + # special cases + if parsed.hostname in [None, '']: + return True + + # special cases + if no_proxy in [None , '']: + return False + if no_proxy == '*': + return True + + no_proxy = no_proxy.lower().replace(' ',''); + entries = ( + host for host in no_proxy.split(',') if host + ) + + if is_ipv4(parsed.hostname): + for item in entries: + if in_ipv4net(parsed.hostname, item): + return True + return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py index 8fc4edbf89a..e6e4596df11 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py @@ -215,6 +215,9 @@ conf = petstore_api.Configuration( self.proxy = None """Proxy URL """ + self.no_proxy = None + """bypass proxy for host in the no_proxy list. + """ self.proxy_headers = None """Proxy headers """ diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py index a38fcec1c84..476138a6bc8 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py @@ -14,8 +14,10 @@ import logging import re import ssl from urllib.parse import urlencode - +from urllib.parse import urlparse +from urllib.request import proxy_bypass_environment import urllib3 +import ipaddress from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError @@ -72,7 +74,7 @@ class RESTClientObject(object): maxsize = 4 # https pool manager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): self.pool_manager = urllib3.ProxyManager( num_pools=pools_size, maxsize=maxsize, @@ -290,3 +292,55 @@ class RESTClientObject(object): _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) + +# end of class RESTClientObject +def is_ipv4(target): + """ Test if IPv4 address or not + """ + try: + chk = ipaddress.IPv4Address(target) + return True + except ipaddress.AddressValueError: + return False + +def in_ipv4net(target, net): + """ Test if target belongs to given IPv4 network + """ + try: + nw = ipaddress.IPv4Network(net) + ip = ipaddress.IPv4Address(target) + if ip in nw: + return True + return False + except ipaddress.AddressValueError: + return False + except ipaddress.NetmaskValueError: + return False + +def should_bypass_proxies(url, no_proxy=None): + """ Yet another requests.should_bypass_proxies + Test if proxies should not be used for a particular url. + """ + + parsed = urlparse(url) + + # special cases + if parsed.hostname in [None, '']: + return True + + # special cases + if no_proxy in [None , '']: + return False + if no_proxy == '*': + return True + + no_proxy = no_proxy.lower().replace(' ',''); + entries = ( + host for host in no_proxy.split(',') if host + ) + + if is_ipv4(parsed.hostname): + for item in entries: + if in_ipv4net(parsed.hostname, item): + return True + return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/client/petstore/scala-httpclient-deprecated/build.gradle b/samples/client/petstore/scala-httpclient-deprecated/build.gradle index 90b3353edf6..db9df898b64 100644 --- a/samples/client/petstore/scala-httpclient-deprecated/build.gradle +++ b/samples/client/petstore/scala-httpclient-deprecated/build.gradle @@ -6,7 +6,7 @@ version = '1.0.0' buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -15,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -77,14 +77,17 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'scala' apply plugin: 'java' - apply plugin: 'maven' + apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - install { - repositories.mavenInstaller { - pom.artifactId = 'scala-legacy-petstore' + publishing { + publications { + maven(MavenPublication) { + artifactId = 'scala-legacy-petstore' + from components.java + } } } diff --git a/samples/client/petstore/scala-httpclient-deprecated/gradlew b/samples/client/petstore/scala-httpclient-deprecated/gradlew old mode 100644 new mode 100755 diff --git a/samples/client/petstore/scala-httpclient/build.gradle b/samples/client/petstore/scala-httpclient/build.gradle index bdfd125549b..6df69a6b5b7 100644 --- a/samples/client/petstore/scala-httpclient/build.gradle +++ b/samples/client/petstore/scala-httpclient/build.gradle @@ -6,7 +6,7 @@ version = '1.0.0' buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:1.5.+' @@ -15,7 +15,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } @@ -23,7 +23,7 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' apply plugin: 'com.github.dcendents.android-maven' - + android { compileSdkVersion 23 buildToolsVersion '23.0.2' @@ -35,7 +35,7 @@ if(hasProperty('target') && target == 'android') { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } - + // Rename the aar correctly libraryVariants.all { variant -> variant.outputs.each { output -> @@ -51,7 +51,7 @@ if(hasProperty('target') && target == 'android') { provided 'javax.annotation:jsr250-api:1.0' } } - + afterEvaluate { android.libraryVariants.all { variant -> def task = project.tasks.create "jar${variant.name.capitalize()}", Jar @@ -63,12 +63,12 @@ if(hasProperty('target') && target == 'android') { artifacts.add('archives', task); } } - + task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' } - + artifacts { archives sourcesJar } @@ -77,17 +77,20 @@ if(hasProperty('target') && target == 'android') { apply plugin: 'scala' apply plugin: 'java' - apply plugin: 'maven' - + apply plugin: 'maven-publish' + sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 - - install { - repositories.mavenInstaller { - pom.artifactId = 'openapi-scala-client' + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-scala-client' + from components.java + } } } - + task execute(type:JavaExec) { main = System.getProperty('mainClass') classpath = sourceSets.main.runtimeClasspath @@ -113,15 +116,15 @@ repositories { } dependencies { - compile "com.fasterxml.jackson.module:jackson-module-scala_2.10:$jackson_version" - compile "com.sun.jersey:jersey-client:$jersey_version" - compile "com.sun.jersey.contribs:jersey-multipart:$jersey_version" - compile "org.jfarcand:jersey-ahc-client:$jersey_async_version" - compile "org.scala-lang:scala-library:$scala_version" - compile "io.swagger:swagger-core:$swagger_core_version" - testCompile "org.scalatest:scalatest_2.10:$scala_test_version" - testCompile "junit:junit:$junit_version" - compile "joda-time:joda-time:$jodatime_version" - compile "org.joda:joda-convert:$joda_version" - compile "com.wordnik.swagger:swagger-async-httpclient_2.10:$swagger_async_httpclient_version" + compileOnly "com.fasterxml.jackson.module:jackson-module-scala_2.10:$jackson_version" + compileOnly "com.sun.jersey:jersey-client:$jersey_version" + compileOnly "com.sun.jersey.contribs:jersey-multipart:$jersey_version" + compileOnly "org.jfarcand:jersey-ahc-client:$jersey_async_version" + compileOnly "org.scala-lang:scala-library:$scala_version" + compileOnly "io.swagger:swagger-core:$swagger_core_version" + testCompileOnly "org.scalatest:scalatest_2.10:$scala_test_version" + testCompileOnly "junit:junit:$junit_version" + compileOnly "joda-time:joda-time:$jodatime_version" + compileOnly "org.joda:joda-convert:$joda_version" + compileOnly "com.wordnik.swagger:swagger-async-httpclient_2.10:$swagger_async_httpclient_version" } diff --git a/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.jar index 87b738cbd05..7454180f2ae 100644 Binary files a/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.jar and b/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.properties index e496c054f69..ffed3a254e9 100644 --- a/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.properties +++ b/samples/client/petstore/scala-httpclient/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/client/petstore/scala-httpclient/gradlew b/samples/client/petstore/scala-httpclient/gradlew index af6708ff229..1b6c787337f 100755 --- a/samples/client/petstore/scala-httpclient/gradlew +++ b/samples/client/petstore/scala-httpclient/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -89,84 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/samples/client/petstore/scala-httpclient/gradlew.bat b/samples/client/petstore/scala-httpclient/gradlew.bat index f9553162f12..107acd32c4e 100644 --- a/samples/client/petstore/scala-httpclient/gradlew.bat +++ b/samples/client/petstore/scala-httpclient/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v10-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts b/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts index ac873acd096..6a74ef3266b 100644 --- a/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts +++ b/samples/client/petstore/typescript-angular-v11-oneOf/builds/default/api/default.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Fruit } from '../model/models'; +// @ts-ignore +import { Fruit } from '../model/fruit'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v11-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts index d8009ed719c..fe63a65b63b 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts index 2f3ced393cc..d1f6b021e97 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts index a1daecfe0d5..74920d0f560 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts index d8009ed719c..fe63a65b63b 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts index 2f3ced393cc..d1f6b021e97 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts index a1daecfe0d5..74920d0f560 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts index 6307beedbe6..867c9a3ea62 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts index df5eb10d6dd..4de27ffefa1 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts index 22cdfe1be90..90ef87d8371 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts index 6307beedbe6..867c9a3ea62 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts index df5eb10d6dd..4de27ffefa1 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts index 22cdfe1be90..90ef87d8371 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts index 6307beedbe6..867c9a3ea62 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts index df5eb10d6dd..4de27ffefa1 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts index 22cdfe1be90..90ef87d8371 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts index 6307beedbe6..867c9a3ea62 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts index df5eb10d6dd..4de27ffefa1 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts index 22cdfe1be90..90ef87d8371 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts index e0b1b6f5c7e..1f775776582 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts index 1bfb6c2e277..bad85023eea 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts index 971e87a39ae..0181b7c6889 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts index 2d8ef08dd39..56e0b0d6e06 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { PetStoreConfiguration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts index ac3e175914e..d561fc8a01d 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { PetStoreConfiguration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts index 8c07bd3cf32..5635e4a0021 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { PetStoreConfiguration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts index 014e9610fd7..c22a87909bc 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts index ff7748156a8..4d3a302a7df 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts index 21931307519..20a37757325 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-any/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/default/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts index 800853664a0..8298d62d182 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/pet.service.ts @@ -18,9 +18,12 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { ApiResponse } from '../model/models'; -import { Pet } from '../model/models'; +// @ts-ignore +import { ApiResponse } from '../model/apiResponse'; +// @ts-ignore +import { Pet } from '../model/pet'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts index 1397ffd2d02..a90fbb92ab8 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/store.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { Order } from '../model/models'; +// @ts-ignore +import { Order } from '../model/order'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts index 9809f730029..f3565253c9c 100644 --- a/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v9-provided-in-root/builds/with-npm/api/user.service.ts @@ -18,8 +18,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { User } from '../model/models'; +// @ts-ignore +import { User } from '../model/user'; +// @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; diff --git a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts index a9bb0facaf2..02f8d3948e0 100644 --- a/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/multiple-parameters/apis/UserApi.ts @@ -278,7 +278,7 @@ export class UserApi extends runtime.BaseAPI { * Logs out current logged in user session */ async logoutUser(initOverrides?: RequestInit): Promise { - await this.logoutUserRaw(, initOverrides); + await this.logoutUserRaw(initOverrides); } /** diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES index 354b10210e0..e0b52bf6e97 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/.openapi-generator/FILES @@ -57,6 +57,8 @@ src/models/Pet.ts src/models/PetPartType.ts src/models/PetPartTypeRecord.ts src/models/PetRecord.ts +src/models/PetRegionsResponse.ts +src/models/PetRegionsResponseRecord.ts src/models/ResponseMeta.ts src/models/ResponseMetaRecord.ts src/models/Tag.ts diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts index fa782af9b14..bdc58ac3a1d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApi.ts @@ -30,6 +30,9 @@ import { Pet, PetFromJSON, PetToJSON, + PetRegionsResponse, + PetRegionsResponseFromJSON, + PetRegionsResponseToJSON, } from '../models'; export interface AddPetRequest { @@ -61,10 +64,19 @@ export interface GetPetByIdRequest { petId: number; } +export interface GetPetRegionsRequest { + petId: number; +} + export interface UpdatePetRequest { body: Pet; } +export interface UpdatePetRegionsRequest { + petId: number; + newRegions: Array>; +} + export interface UpdatePetWithFormRequest { petId: number; name?: string; @@ -357,6 +369,36 @@ export class PetApi extends runtime.BaseAPI { return await response.value(); } + /** + * Gets regions for a single pet. + */ + async getPetRegionsRaw(requestParameters: GetPetRegionsRequest, initOverrides?: RequestInit): Promise> { + if (requestParameters.petId === null || requestParameters.petId === undefined) { + throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetRegions.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue)); + } + + /** + * Gets regions for a single pet. + */ + async getPetRegions(petId: number, initOverrides?: RequestInit): Promise { + const response = await this.getPetRegionsRaw({ petId: petId }, initOverrides); + return await response.value(); + } + /** * Update an existing pet */ @@ -394,6 +436,43 @@ export class PetApi extends runtime.BaseAPI { await this.updatePetRaw({ body: body }, initOverrides); } + /** + * Updates the pet regions. + */ + async updatePetRegionsRaw(requestParameters: UpdatePetRegionsRequest, initOverrides?: RequestInit): Promise> { + if (requestParameters.petId === null || requestParameters.petId === undefined) { + throw new runtime.RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetRegions.'); + } + + if (requestParameters.newRegions === null || requestParameters.newRegions === undefined) { + throw new runtime.RequiredError('newRegions','Required parameter requestParameters.newRegions was null or undefined when calling updatePetRegions.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request({ + path: `/pet/{petId}/regions`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + method: 'PUT', + headers: headerParameters, + query: queryParameters, + body: requestParameters.newRegions, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => PetRegionsResponseFromJSON(jsonValue)); + } + + /** + * Updates the pet regions. + */ + async updatePetRegions(petId: number, newRegions: Array>, initOverrides?: RequestInit): Promise { + const response = await this.updatePetRegionsRaw({ petId: petId, newRegions: newRegions }, initOverrides); + return await response.value(); + } + /** * Updates a pet in the store with form data */ diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts index 202ec780b63..b2c83e26802 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/PetApiSagas.ts @@ -35,6 +35,9 @@ import { Pet, PetRecord, petRecordUtils, + PetRegionsResponse, + PetRegionsResponseRecord, + petRegionsResponseRecordUtils, UserRecord, } from '../models'; @@ -52,7 +55,9 @@ export const petApiSagaMap = new Map Generator>([ ["findPetsByTags", findPetsByTagsSaga], ["findPetsByUserIds", findPetsByUserIdsSaga], ["getPetById", getPetByIdSaga], + ["getPetRegions", getPetRegionsSaga], ["updatePet", updatePetSaga], + ["updatePetRegions", updatePetRegionsSaga], ["updatePetWithForm", updatePetWithFormSaga], ["uploadFile", uploadFileSaga], ] @@ -180,7 +185,7 @@ export function *findPetsByIdsSagaImp(_action_: Action) { yield put(findPetsByIdsRequest(requestPayload)); const response: Required> = yield apiCall(Api.petApi, Api.petApi.findPetsByIds, - ids.map(p => parseFloat(p)).toArray(), + ids.map(p => (p ? parseFloat(p) : null) as number ).toArray(), ); let successReturnValue: any = undefined; @@ -339,7 +344,7 @@ export function *findPetsByUserIdsSagaImp(_action_: Action = yield apiCall(Api.petApi, Api.petApi.findPetsByUserIds, - ids.map(p => parseFloat(p)).toArray(), + ids.map(p => (p ? parseFloat(p) : null) as number ).toArray(), ); let successReturnValue: any = undefined; @@ -414,6 +419,50 @@ export function *getPetByIdSagaImp(_action_: Action) { } } //endregion +//region getPetRegions + +export interface PayloadGetPetRegions extends PayloadGetPetRegionsRequest, BasePayloadApiAction { +} + +export interface PayloadGetPetRegionsRequest { + petId: string; +} + +export const getPetRegionsRequest = createSagaAction("getPetRegionsRequest"); +export const getPetRegionsSuccess = createSagaAction>>("getPetRegionsSuccess"); +export const getPetRegionsFailure = createSagaAction<{error: any, requestPayload: PayloadGetPetRegions}>("getPetRegionsFailure"); + +export const getPetRegions = createSagaAction("getPetRegions"); + +export function *getPetRegionsSaga() { + yield takeLatest(getPetRegions, getPetRegionsSagaImp); +} + +export function *getPetRegionsSagaImp(_action_: Action) { + const {markErrorsAsHandled, ..._payloadRest_} = _action_.payload; + try { + const { + petId, + } = _payloadRest_; + + yield put(getPetRegionsRequest(_action_.payload)); + + const response: Required = yield apiCall(Api.petApi, Api.petApi.getPetRegions, + parseFloat(petId), + ); + + let successReturnValue: any = undefined; + successReturnValue = petRegionsResponseRecordUtils.fromApiPassthrough(response); + yield put(getPetRegionsSuccess(successReturnValue)); + + return successReturnValue; + } catch (error) { + if (markErrorsAsHandled) {error.wasHandled = true; } + yield put(getPetRegionsFailure({error, requestPayload: _action_.payload})); + return error; + } +} +//endregion //region updatePet export interface PayloadUpdatePet extends PayloadUpdatePetRequest, BasePayloadApiAction { @@ -456,6 +505,53 @@ export function *updatePetSagaImp(_action_: Action) { } } //endregion +//region updatePetRegions + +export interface PayloadUpdatePetRegions extends PayloadUpdatePetRegionsRequest, BasePayloadApiAction { +} + +export interface PayloadUpdatePetRegionsRequest { + petId: string; + newRegions: List>; +} + +export const updatePetRegionsRequest = createSagaAction("updatePetRegionsRequest"); +export const updatePetRegionsSuccess = createSagaAction>>("updatePetRegionsSuccess"); +export const updatePetRegionsFailure = createSagaAction<{error: any, requestPayload: PayloadUpdatePetRegions}>("updatePetRegionsFailure"); + +export const updatePetRegions = createSagaAction("updatePetRegions"); + +export function *updatePetRegionsSaga() { + yield takeLatest(updatePetRegions, updatePetRegionsSagaImp); +} + +export function *updatePetRegionsSagaImp(_action_: Action) { + const {markErrorsAsHandled, ..._payloadRest_} = _action_.payload; + try { + const { + petId, + newRegions, + } = _payloadRest_; + + yield put(updatePetRegionsRequest(_action_.payload)); + + const response: Required = yield apiCall(Api.petApi, Api.petApi.updatePetRegions, + parseFloat(petId), + newRegions.map(p => p.toArray().map(p2 => (p2 ? parseFloat(p2) : null) as number)).toArray(), + ); + + let successReturnValue: any = undefined; + successReturnValue = petRegionsResponseRecordUtils.fromApiPassthrough(response); + yield put(updatePetRegionsSuccess(successReturnValue)); + + return successReturnValue; + } catch (error) { + if (markErrorsAsHandled) {error.wasHandled = true; } + yield put(updatePetRegionsFailure({error, requestPayload: _action_.payload})); + return error; + } +} +//endregion //region updatePetWithForm export interface PayloadUpdatePetWithForm extends PayloadUpdatePetWithFormRequest, BasePayloadApiAction { diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts index 21a49677e50..2738f38028e 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/SagaApiManager.ts @@ -18,15 +18,7 @@ export class Api { public static storeApi: StoreApi; public static userApi: UserApi; - public static init(apiBasePath: string) { - const apiBaseConfig: ConfigurationParameters = { - basePath: apiBasePath, - credentials: "include", - headers: { - 'Cache-Control': 'no-cache, no-store' // this is needed to prevent stalling issues in Chrome. Also it is a good behavior for api calls. - } - }; - + public static init(apiBaseConfig: ConfigurationParameters) { Api.behaviorApi = new BehaviorApi(new Configuration(apiBaseConfig)); Api.petApi = new PetApi(new Configuration(apiBaseConfig)); Api.petPartApi = new PetPartApi(new Configuration(apiBaseConfig)); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts index 46b07183de4..85c14668d0c 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/apis/UserApi.ts @@ -281,7 +281,7 @@ export class UserApi extends runtime.BaseAPI { * Logs out current logged in user session */ async logoutUser(initOverrides?: RequestInit): Promise { - await this.logoutUserRaw(, initOverrides); + await this.logoutUserRaw(initOverrides); } /** diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts index f69d536f6ea..6327071c4ee 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/CategoryRecord.ts @@ -61,6 +61,7 @@ class CategoryRecordUtils extends ApiRecordUtils { public *toInlined(entityId?: string | null) { if (!entityId) {return undefined; } + // @ts-ignore const entity = yield select(apiEntityCategorySelector, {id: entityId}); if (!entity) {return undefined; } @@ -82,6 +83,7 @@ class CategoryRecordUtils extends ApiRecordUtils { if (!entityIds) {return null; } let entities = List(); for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) { + // @ts-ignore const entity = yield call(this.toInlined, entityIds.get(entityIndex)); if (entity) { entities.push(entity); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts new file mode 100644 index 00000000000..0bf9c2f561c --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponse.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import { + ResponseMeta, + ResponseMetaFromJSON, + ResponseMetaFromJSONTyped, + ResponseMetaToJSON, +} from './'; + +/** + * + * @export + * @interface GetPetRegionsResponse + */ +export interface GetPetRegionsResponse { + /** + * + * @type {ResponseMeta} + * @memberof GetPetRegionsResponse + */ + meta: ResponseMeta; + /** + * An array of all 15-minute time slots in 24 hours. + * @type {Array>} + * @memberof GetPetRegionsResponse + */ + data?: Array>; +} + +export function GetPetRegionsResponseFromJSON(json: any): GetPetRegionsResponse { + return GetPetRegionsResponseFromJSONTyped(json, false); +} + +export function GetPetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GetPetRegionsResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'meta': ResponseMetaFromJSON(json['meta']), + 'data': !exists(json, 'data') ? undefined : json['data'], + }; +} + +export function GetPetRegionsResponseToJSON(value?: GetPetRegionsResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'meta': ResponseMetaToJSON(value.meta), + 'data': value.data, + }; +} + + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts new file mode 100644 index 00000000000..85082fa01a4 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/GetPetRegionsResponseRecord.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import {ApiRecordUtils, knownRecordFactories, appFromJS, NormalizedRecordEntities} from "../runtimeSagasAndRecords"; +import {getApiEntitiesState} from "../ApiEntitiesSelectors" +import {List, Record, RecordOf, Map} from 'immutable'; +import {Schema, schema, NormalizedSchema} from "normalizr"; +import {select, call} from "redux-saga/effects"; + +import { + GetPetRegionsResponse, +} from './GetPetRegionsResponse'; + +import { + ResponseMeta, +} from './ResponseMeta'; + +import { + ResponseMetaRecord, + responseMetaRecordUtils +} from './ResponseMetaRecord'; + +export const GetPetRegionsResponseRecordProps = { + recType: "GetPetRegionsResponseApiRecord" as "GetPetRegionsResponseApiRecord", + meta: ResponseMetaRecord(), + data: null as List> | null, +}; + +export type GetPetRegionsResponseRecordPropsType = typeof GetPetRegionsResponseRecordProps; +export const GetPetRegionsResponseRecord = Record(GetPetRegionsResponseRecordProps, GetPetRegionsResponseRecordProps.recType); +export type GetPetRegionsResponseRecord = RecordOf; + +knownRecordFactories.set(GetPetRegionsResponseRecordProps.recType, GetPetRegionsResponseRecord); + + +class GetPetRegionsResponseRecordUtils extends ApiRecordUtils { + public normalize(apiObject: GetPetRegionsResponse, asEntity?: boolean): GetPetRegionsResponse { + (apiObject as any).recType = GetPetRegionsResponseRecordProps.recType; + responseMetaRecordUtils.normalize(apiObject.meta); + if (apiObject.data) { (apiObject as any).data = apiObject.data.map(item => item.map(item2 => item2?.toString())); } + return apiObject; + } + + public toApi(record: GetPetRegionsResponseRecord): GetPetRegionsResponse { + const apiObject = super.toApi(record); + apiObject.meta = responseMetaRecordUtils.toApi(record.meta); + if (record.data) { apiObject.data = record.data.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } + return apiObject; + } + + public fromApiPassthrough(apiObject: GetPetRegionsResponse): List> { + return appFromJS(apiObject.data); + } + + public fromApiPassthroughAsEntities(apiObject: GetPetRegionsResponse): NormalizedRecordEntities { + console.log("entities revival not supported on this response"); + return {entities: {}, result: List()}; + } +} + +export const getPetRegionsResponseRecordUtils = new GetPetRegionsResponseRecordUtils(); + + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts index 621b298df80..9422abd83ec 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/OrderRecord.ts @@ -66,6 +66,7 @@ class OrderRecordUtils extends ApiRecordUtils { public *toInlined(entityId?: string | null) { if (!entityId) {return undefined; } + // @ts-ignore const entity = yield select(apiEntityOrderSelector, {id: entityId}); if (!entity) {return undefined; } @@ -87,6 +88,7 @@ class OrderRecordUtils extends ApiRecordUtils { if (!entityIds) {return null; } let entities = List(); for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) { + // @ts-ignore const entity = yield call(this.toInlined, entityIds.get(entityIndex)); if (entity) { entities.push(entity); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts index 52488a844be..2b59b900171 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/Pet.ts @@ -158,6 +158,12 @@ export interface Pet { * @memberof Pet */ status: PetStatusEnum; + /** + * An array of all 15-minute time slots in 24 hours. + * @type {Array>} + * @memberof Pet + */ + regions?: Array>; } /** @@ -200,6 +206,7 @@ export function PetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pet { 'tags': ((json['tags'] as Array).map(TagFromJSON)), 'optionalTags': !exists(json, 'optionalTags') ? undefined : ((json['optionalTags'] as Array).map(TagFromJSON)), 'status': json['status'], + 'regions': !exists(json, 'regions') ? undefined : json['regions'], }; } @@ -232,6 +239,7 @@ export function PetToJSON(value?: Pet | null): any { 'tags': ((value.tags as Array).map(TagToJSON)), 'optionalTags': value.optionalTags === undefined ? undefined : ((value.optionalTags as Array).map(TagToJSON)), 'status': value.status, + 'regions': value.regions, }; } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts index 8292c5ee074..5cb401603d8 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRecord.ts @@ -67,6 +67,7 @@ export const PetRecordProps = { tags: (TagRecord(), List()), optionalTags: (TagRecord(), null as List | null), status: PetStatusEnum.Pending, + regions: null as List> | null, }; export type PetRecordPropsType = typeof PetRecordProps; @@ -96,12 +97,13 @@ class PetRecordUtils extends ApiRecordUtils { (apiObject as any).recType = asEntity ? PetRecordEntityProps.recType : PetRecordProps.recType; (apiObject as any).id = apiObject.id.toString(); if (apiObject.friendId) { (apiObject as any).friendId = apiObject.friendId.toString(); } - (apiObject as any).otherFriendIds = apiObject.otherFriendIds.map(item => item.toString()); + (apiObject as any).otherFriendIds = apiObject.otherFriendIds.map(item => item?.toString()); categoryRecordUtils.normalize(apiObject.category); if (apiObject.optionalCategory) { categoryRecordUtils.normalize(apiObject.optionalCategory); } if (apiObject._entries) { categoryRecordUtils.normalizeArray(apiObject._entries); } tagRecordUtils.normalizeArray(apiObject.tags); if (apiObject.optionalTags) { tagRecordUtils.normalizeArray(apiObject.optionalTags); } + if (apiObject.regions) { (apiObject as any).regions = apiObject.regions.map(item => item.map(item2 => item2?.toString())); } return apiObject; } @@ -117,6 +119,7 @@ class PetRecordUtils extends ApiRecordUtils { public *toInlined(entityId?: string | null) { if (!entityId) {return undefined; } + // @ts-ignore const entity = yield select(apiEntityPetSelector, {id: entityId}); if (!entity) {return undefined; } @@ -131,10 +134,15 @@ class PetRecordUtils extends ApiRecordUtils { } = entity; const entityProperties = { + // @ts-ignore category: yield call(categoryRecordUtils.toInlined, entity.category), + // @ts-ignore optionalCategory: entity.optionalCategory ? yield call(categoryRecordUtils.toInlined, entity.optionalCategory) : null, + // @ts-ignore _entries: entity._entries ? yield call(categoryRecordUtils.toInlinedArray, entity._entries) : null, + // @ts-ignore tags: yield call(tagRecordUtils.toInlinedArray, entity.tags), + // @ts-ignore optionalTags: entity.optionalTags ? yield call(tagRecordUtils.toInlinedArray, entity.optionalTags) : null, } @@ -148,6 +156,7 @@ class PetRecordUtils extends ApiRecordUtils { if (!entityIds) {return null; } let entities = List(); for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) { + // @ts-ignore const entity = yield call(this.toInlined, entityIds.get(entityIndex)); if (entity) { entities.push(entity); @@ -160,12 +169,13 @@ class PetRecordUtils extends ApiRecordUtils { const apiObject = super.toApi(record); apiObject.id = parseFloat(record.id); if (record.friendId) { apiObject.friendId = parseFloat(record.friendId); } - apiObject.otherFriendIds = record.otherFriendIds.map(item => parseFloat(item)).toArray(); + apiObject.otherFriendIds = record.otherFriendIds.map(item => (item ? parseFloat(item) : null) as number).toArray(); apiObject.category = categoryRecordUtils.toApi(record.category); if (record.optionalCategory) { apiObject.optionalCategory = categoryRecordUtils.toApi(record.optionalCategory); } if (record._entries) { apiObject._entries = categoryRecordUtils.toApiArray(record._entries); } apiObject.tags = tagRecordUtils.toApiArray(record.tags); if (record.optionalTags) { apiObject.optionalTags = tagRecordUtils.toApiArray(record.optionalTags); } + if (record.regions) { apiObject.regions = record.regions.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } return apiObject; } } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts new file mode 100644 index 00000000000..7b4c268864d --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponse.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import { + ResponseMeta, + ResponseMetaFromJSON, + ResponseMetaFromJSONTyped, + ResponseMetaToJSON, +} from './'; + +/** + * + * @export + * @interface PetRegionsResponse + */ +export interface PetRegionsResponse { + /** + * + * @type {ResponseMeta} + * @memberof PetRegionsResponse + */ + meta: ResponseMeta; + /** + * An array of all 15-minute time slots in 24 hours. + * @type {Array>} + * @memberof PetRegionsResponse + */ + data?: Array>; +} + +export function PetRegionsResponseFromJSON(json: any): PetRegionsResponse { + return PetRegionsResponseFromJSONTyped(json, false); +} + +export function PetRegionsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): PetRegionsResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'meta': ResponseMetaFromJSON(json['meta']), + 'data': !exists(json, 'data') ? undefined : json['data'], + }; +} + +export function PetRegionsResponseToJSON(value?: PetRegionsResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'meta': ResponseMetaToJSON(value.meta), + 'data': value.data, + }; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts new file mode 100644 index 00000000000..a56180207a5 --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetRegionsResponseRecord.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import {ApiRecordUtils, knownRecordFactories, appFromJS, NormalizedRecordEntities} from "../runtimeSagasAndRecords"; +import {getApiEntitiesState} from "../ApiEntitiesSelectors" +import {List, Record, RecordOf, Map} from 'immutable'; +import {Schema, schema, NormalizedSchema} from "normalizr"; +import {select, call} from "redux-saga/effects"; + +import { + PetRegionsResponse, +} from './PetRegionsResponse'; + +import { + ResponseMeta, +} from './ResponseMeta'; + +import { + ResponseMetaRecord, + responseMetaRecordUtils +} from './ResponseMetaRecord'; + +export const PetRegionsResponseRecordProps = { + recType: "PetRegionsResponseApiRecord" as "PetRegionsResponseApiRecord", + meta: ResponseMetaRecord(), + data: null as List> | null, +}; + +export type PetRegionsResponseRecordPropsType = typeof PetRegionsResponseRecordProps; +export const PetRegionsResponseRecord = Record(PetRegionsResponseRecordProps, PetRegionsResponseRecordProps.recType); +export type PetRegionsResponseRecord = RecordOf; + +knownRecordFactories.set(PetRegionsResponseRecordProps.recType, PetRegionsResponseRecord); + + +class PetRegionsResponseRecordUtils extends ApiRecordUtils { + public normalize(apiObject: PetRegionsResponse, asEntity?: boolean): PetRegionsResponse { + (apiObject as any).recType = PetRegionsResponseRecordProps.recType; + responseMetaRecordUtils.normalize(apiObject.meta); + if (apiObject.data) { (apiObject as any).data = apiObject.data.map(item => item.map(item2 => item2?.toString())); } + return apiObject; + } + + public toApi(record: PetRegionsResponseRecord): PetRegionsResponse { + const apiObject = super.toApi(record); + apiObject.meta = responseMetaRecordUtils.toApi(record.meta); + if (record.data) { apiObject.data = record.data.map(item => item.toArray().map(item2 => (item2 ? parseFloat(item2) : null) as number)).toArray(); } + return apiObject; + } + + public fromApiPassthrough(apiObject: PetRegionsResponse): List> { + return appFromJS(apiObject.data); + } + + public fromApiPassthroughAsEntities(apiObject: PetRegionsResponse): NormalizedRecordEntities { + console.log("entities revival not supported on this response"); + return {entities: {}, result: List()}; + } +} + +export const petRegionsResponseRecordUtils = new PetRegionsResponseRecordUtils(); + + diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts index dd3b631ac85..b14cd7e7195 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/TagRecord.ts @@ -61,6 +61,7 @@ class TagRecordUtils extends ApiRecordUtils { public *toInlined(entityId?: string | null) { if (!entityId) {return undefined; } + // @ts-ignore const entity = yield select(apiEntityTagSelector, {id: entityId}); if (!entity) {return undefined; } @@ -82,6 +83,7 @@ class TagRecordUtils extends ApiRecordUtils { if (!entityIds) {return null; } let entities = List(); for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) { + // @ts-ignore const entity = yield call(this.toInlined, entityIds.get(entityIndex)); if (entity) { entities.push(entity); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts index 292519c32b2..0d892e64a75 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/UserRecord.ts @@ -69,6 +69,7 @@ class UserRecordUtils extends ApiRecordUtils { public *toInlined(entityId?: string | null) { if (!entityId) {return undefined; } + // @ts-ignore const entity = yield select(apiEntityUserSelector, {id: entityId}); if (!entity) {return undefined; } @@ -90,6 +91,7 @@ class UserRecordUtils extends ApiRecordUtils { if (!entityIds) {return null; } let entities = List(); for (let entityIndex = 0; entityIndex < entityIds.count(); entityIndex++) { + // @ts-ignore const entity = yield call(this.toInlined, entityIds.get(entityIndex)); if (entity) { entities.push(entity); diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts index b4f59662cbc..aac3503a1f5 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/index.ts @@ -34,6 +34,8 @@ export * from './PartRecord'; export * from './Pet'; export * from './PetRecord'; export * from './PetPartType'; +export * from './PetRegionsResponse'; +export * from './PetRegionsResponseRecord'; export * from './ResponseMeta'; export * from './ResponseMetaRecord'; export * from './Tag'; diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml index 008335f4466..bf885a5080c 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/pom.xml @@ -36,7 +36,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -84,16 +84,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.2.0 - jar test-jar @@ -101,11 +99,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -138,8 +135,8 @@ maven-compiler-plugin 3.8.1 - 1.7 - 1.7 + 1.8 + 1.8 true 128m 512m @@ -152,7 +149,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -163,7 +160,7 @@ none - 1.7 + 1.8 http.response.details @@ -176,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -270,17 +267,16 @@ jackson-databind-nullable ${jackson-databind-nullable-version}
+ + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + com.github.joschi.jackson jackson-datatype-threetenbp ${threetenbp-version} - - - com.brsanthu - migbase64 - 2.2 - jakarta.annotation jakarta.annotation-api diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java index 7997f7ec2d4..f5874d83bf2 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java +++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java @@ -3,6 +3,7 @@ package org.openapitools.client; import org.threeten.bp.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; @@ -21,7 +22,7 @@ public class JSON implements ContextResolver { public JSON() { mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py index e5e2f7d53e3..d3b86dbde09 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/configuration.py @@ -199,6 +199,9 @@ conf = x_auth_id_alias.Configuration( self.proxy = None """Proxy URL """ + self.no_proxy = None + """bypass proxy for host in the no_proxy list. + """ self.proxy_headers = None """Proxy headers """ diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py index a7c5fd3304a..c3566a6d0b2 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/rest.py @@ -14,8 +14,10 @@ import logging import re import ssl from urllib.parse import urlencode - +from urllib.parse import urlparse +from urllib.request import proxy_bypass_environment import urllib3 +import ipaddress from x_auth_id_alias.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError @@ -72,7 +74,7 @@ class RESTClientObject(object): maxsize = 4 # https pool manager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): self.pool_manager = urllib3.ProxyManager( num_pools=pools_size, maxsize=maxsize, @@ -290,3 +292,55 @@ class RESTClientObject(object): _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) + +# end of class RESTClientObject +def is_ipv4(target): + """ Test if IPv4 address or not + """ + try: + chk = ipaddress.IPv4Address(target) + return True + except ipaddress.AddressValueError: + return False + +def in_ipv4net(target, net): + """ Test if target belongs to given IPv4 network + """ + try: + nw = ipaddress.IPv4Network(net) + ip = ipaddress.IPv4Address(target) + if ip in nw: + return True + return False + except ipaddress.AddressValueError: + return False + except ipaddress.NetmaskValueError: + return False + +def should_bypass_proxies(url, no_proxy=None): + """ Yet another requests.should_bypass_proxies + Test if proxies should not be used for a particular url. + """ + + parsed = urlparse(url) + + # special cases + if parsed.hostname in [None, '']: + return True + + # special cases + if no_proxy in [None , '']: + return False + if no_proxy == '*': + return True + + no_proxy = no_proxy.lower().replace(' ',''); + entries = ( + host for host in no_proxy.split(',') if host + ) + + if is_ipv4(parsed.hostname): + for item in entries: + if in_ipv4net(parsed.hostname, item): + return True + return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py index e90b08da266..afda4f4fd36 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/configuration.py @@ -179,6 +179,9 @@ class Configuration(object): self.proxy = None """Proxy URL """ + self.no_proxy = None + """bypass proxy for host in the no_proxy list. + """ self.proxy_headers = None """Proxy headers """ diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py index 191d850b87d..b73beb6fd00 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/rest.py @@ -14,8 +14,10 @@ import logging import re import ssl from urllib.parse import urlencode - +from urllib.parse import urlparse +from urllib.request import proxy_bypass_environment import urllib3 +import ipaddress from dynamic_servers.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError @@ -72,7 +74,7 @@ class RESTClientObject(object): maxsize = 4 # https pool manager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): self.pool_manager = urllib3.ProxyManager( num_pools=pools_size, maxsize=maxsize, @@ -290,3 +292,55 @@ class RESTClientObject(object): _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) + +# end of class RESTClientObject +def is_ipv4(target): + """ Test if IPv4 address or not + """ + try: + chk = ipaddress.IPv4Address(target) + return True + except ipaddress.AddressValueError: + return False + +def in_ipv4net(target, net): + """ Test if target belongs to given IPv4 network + """ + try: + nw = ipaddress.IPv4Network(net) + ip = ipaddress.IPv4Address(target) + if ip in nw: + return True + return False + except ipaddress.AddressValueError: + return False + except ipaddress.NetmaskValueError: + return False + +def should_bypass_proxies(url, no_proxy=None): + """ Yet another requests.should_bypass_proxies + Test if proxies should not be used for a particular url. + """ + + parsed = urlparse(url) + + # special cases + if parsed.hostname in [None, '']: + return True + + # special cases + if no_proxy in [None , '']: + return False + if no_proxy == '*': + return True + + no_proxy = no_proxy.lower().replace(' ',''); + entries = ( + host for host in no_proxy.split(',') if host + ) + + if is_ipv4(parsed.hostname): + for item in entries: + if in_ipv4net(parsed.hostname, item): + return True + return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock index d551818e23c..fa4f795327d 100644 --- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.lock @@ -5,224 +5,224 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "21.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.5.0" args: dependency: transitive description: name: args - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" async: dependency: transitive description: name: async - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.7.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" built_collection: dependency: "direct dev" description: name: built_collection - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "5.1.0" built_value: dependency: "direct dev" description: name: built_value - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "8.1.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" cli_util: dependency: transitive description: name: cli_util - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" collection: dependency: transitive description: name: collection - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" convert: dependency: transitive description: name: convert - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" coverage: dependency: transitive description: name: coverage - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" crypto: dependency: transitive description: name: crypto - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" dio: dependency: "direct dev" description: name: dio - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" file: dependency: transitive description: name: file - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "6.1.1" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" glob: dependency: transitive description: name: glob - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" http_mock_adapter: dependency: "direct dev" description: name: http_mock_adapter - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.2" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" io: dependency: transitive description: name: io - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" js: dependency: transitive description: name: js - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.6.3" logging: dependency: transitive description: name: logging - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.12.10" meta: dependency: transitive description: name: meta - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" mime: dependency: transitive description: name: mime - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" mockito: dependency: "direct dev" description: name: mockito - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "5.0.11" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" openapi: @@ -236,182 +236,182 @@ packages: dependency: transitive description: name: package_config - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" path: dependency: transitive description: name: path - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.8.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.11.0" pool: dependency: transitive description: name: pool - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" shelf: dependency: transitive description: name: shelf - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.4" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" source_gen: dependency: transitive description: name: source_gen - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test: dependency: "direct dev" description: name: test - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.17.4" test_api: dependency: transitive description: name: test_api - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.4.0" test_core: dependency: transitive description: name: test_core - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.24" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "6.2.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" sdks: diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock index 4355ed26f68..f23a0ab8a16 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake_tests/pubspec.lock @@ -5,231 +5,231 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "12.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.40.6" args: dependency: transitive description: name: args - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.6.0" async: dependency: transitive description: name: async - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" built_collection: dependency: "direct dev" description: name: built_collection - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.3.2" built_value: dependency: "direct dev" description: name: built_value - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "7.1.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" cli_util: dependency: transitive description: name: cli_util - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.2.0" clock: dependency: transitive description: name: clock - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" convert: dependency: transitive description: name: convert - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.14.2" crypto: dependency: transitive description: name: crypto - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.5" dio: dependency: "direct dev" description: name: dio - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.10" file: dependency: transitive description: name: file - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "5.2.1" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.10.11" glob: dependency: transitive description: name: glob - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" http: dependency: transitive description: name: http - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.12.2" http_mock_adapter: dependency: "direct dev" description: name: http_mock_adapter - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.1.6" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.2.0" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.1.4" intl: dependency: transitive description: name: intl - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.5" js: dependency: transitive description: name: js - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.6.3" logging: dependency: transitive description: name: logging - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.11.4" matcher: dependency: transitive description: name: matcher - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.12.9" meta: dependency: transitive description: name: meta - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" mime: dependency: transitive description: name: mime - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" mockito: dependency: "direct overridden" description: name: mockito - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.1.1" node_interop: dependency: transitive description: name: node_interop - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.1" node_io: dependency: transitive description: name: node_io - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.4.13" openapi: @@ -243,182 +243,182 @@ packages: dependency: transitive description: name: package_config - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.9.3" path: dependency: transitive description: name: path - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.8.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.11.0" pool: dependency: transitive description: name: pool - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.4.4" quiver: dependency: transitive description: name: quiver - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.5" shelf: dependency: transitive description: name: shelf - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.7.9" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.2.9+2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.2.4+1" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test: dependency: "direct dev" description: name: test - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.15.5" test_api: dependency: transitive description: name: test_api - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.2.18+1" test_core: dependency: transitive description: name: test_core - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.11+2" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.2.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.9.7+15" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.7.5" yaml: dependency: transitive description: name: yaml - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.2.1" sdks: diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock b/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock index 9b351ff283a..dd5bbc89254 100644 --- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock +++ b/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock @@ -5,224 +5,224 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "14.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.41.2" args: dependency: transitive description: name: args - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" async: dependency: transitive description: name: async - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.7.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.6.2" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "5.1.0" built_value: dependency: transitive description: name: built_value - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "8.1.1" charcode: dependency: transitive description: name: charcode - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" cli_util: dependency: transitive description: name: cli_util - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.3" clock: dependency: transitive description: name: clock - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.7.0" collection: dependency: "direct dev" description: name: collection - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" convert: dependency: transitive description: name: convert - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.15.2" crypto: dependency: transitive description: name: crypto - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.12" file: dependency: transitive description: name: file - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "6.1.2" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" glob: dependency: transitive description: name: glob - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" http: dependency: "direct dev" description: name: http - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.13.3" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" intl: dependency: transitive description: name: intl - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.6.3" logging: dependency: transitive description: name: logging - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.12.10" meta: dependency: "direct dev" description: name: meta - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.6.0" mime: dependency: transitive description: name: mime - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" mockito: dependency: "direct dev" description: name: mockito - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "4.1.4" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.4.13" openapi: @@ -236,182 +236,182 @@ packages: dependency: transitive description: name: package_config - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.9.3" path: dependency: transitive description: name: path - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.8.0" pedantic: dependency: transitive description: name: pedantic - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.11.1" pool: dependency: transitive description: name: pool - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" shelf: dependency: transitive description: name: shelf - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" source_gen: dependency: transitive description: name: source_gen - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.9.10+3" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test: dependency: "direct dev" description: name: test - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.16.5" test_api: dependency: transitive description: name: test_api - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.2.19" test_core: dependency: transitive description: name: test_core - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "0.3.15" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "6.2.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.intern.sk" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" sdks: diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml index 359dda5143e..744e22b67e3 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/pom.xml @@ -36,7 +36,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -84,16 +84,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.2.0 - jar test-jar @@ -101,11 +99,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -138,8 +135,8 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 1.8 + 1.8 true 128m 512m @@ -152,7 +149,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -163,7 +160,7 @@ none - 1.8 + 1.8 http.response.details @@ -176,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources diff --git a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java index 69a73213d8e..88345206919 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8-special-characters/src/main/java/org/openapitools/client/JSON.java @@ -2,6 +2,7 @@ package org.openapitools.client; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.openapitools.client.model.*; @@ -21,7 +22,7 @@ public class JSON implements ContextResolver { public JSON() { mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle index 9e7ef31e808..dc5f013f2a8 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.gradle @@ -103,7 +103,7 @@ ext { jakarta_annotation_version = "1.3.5" jersey_version = "2.35" junit_version = "4.13.2" - scribejava_apis_version = "6.9.0" + scribejava_apis_version = "8.3.1" tomitribe_http_signatures_version = "1.7" } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt index b8e4d398e1a..a427b720ebd 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/openapi3/client/petstore/java/jersey2-java8/build.sbt @@ -21,7 +21,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-databind" % "2.13.0" % "compile", "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.13.0" % "compile", "org.openapitools" % "jackson-databind-nullable" % "0.2.1" % "compile", - "com.github.scribejava" % "scribejava-apis" % "6.9.0" % "compile", + "com.github.scribejava" % "scribejava-apis" % "8.3.1" % "compile", "org.tomitribe" % "tomitribe-http-signatures" % "1.7" % "compile", "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", "junit" % "junit" % "4.13.2" % "test", diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml index 416ff72b7eb..fae535e28b0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml @@ -36,7 +36,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M1 + 3.0.0 enforce-maven @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M4 + 3.0.0-M5 @@ -84,16 +84,14 @@ - org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.2.0 - jar test-jar @@ -101,11 +99,10 @@ - org.codehaus.mojo build-helper-maven-plugin - 1.10 + 3.2.0 add_sources @@ -138,8 +135,8 @@ maven-compiler-plugin 3.8.1 - 1.8 - 1.8 + 1.8 + 1.8 true 128m 512m @@ -152,7 +149,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.1 attach-javadocs @@ -163,7 +160,7 @@ none - 1.8 + 1.8 http.response.details @@ -176,7 +173,7 @@ org.apache.maven.plugins maven-source-plugin - 2.2.1 + 3.2.0 attach-sources @@ -314,6 +311,6 @@ 1.3.5 4.13.2 1.7 - 6.9.0 + 8.3.1 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java index 69a73213d8e..88345206919 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/JSON.java @@ -2,6 +2,7 @@ package org.openapitools.client; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; import org.openapitools.jackson.nullable.JsonNullableModule; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.openapitools.client.model.*; @@ -21,7 +22,7 @@ public class JSON implements ContextResolver { public JSON() { mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); + JsonMapper.builder().configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); diff --git a/samples/openapi3/client/petstore/java/native/build.gradle b/samples/openapi3/client/petstore/java/native/build.gradle index 2979e384fef..a5b272d239d 100644 --- a/samples/openapi3/client/petstore/java/native/build.gradle +++ b/samples/openapi3/client/petstore/java/native/build.gradle @@ -6,18 +6,16 @@ version = '1.0.0' buildscript { repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } } repositories { - maven { url "https://repo1.maven.org/maven2" } - jcenter() + mavenCentral() } apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -33,9 +31,12 @@ javadoc { options.encoding = 'UTF-8' } -install { - repositories.mavenInstaller { - pom.artifactId = 'petstore-openapi3-native' +publishing { + publications { + maven(MavenPublication) { + artifactId = 'petstore-openapi3-native' + from components.java + } } } diff --git a/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar index e708b1c023e..7454180f2ae 100644 Binary files a/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar and b/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties index 4d9ca164914..ffed3a254e9 100644 --- a/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties +++ b/samples/openapi3/client/petstore/java/native/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/openapi3/client/petstore/java/native/gradlew b/samples/openapi3/client/petstore/java/native/gradlew old mode 100644 new mode 100755 index 4f906e0c811..1b6c787337f --- a/samples/openapi3/client/petstore/java/native/gradlew +++ b/samples/openapi3/client/petstore/java/native/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/build.gradle b/samples/openapi3/client/petstore/kotlin-multiplatform/build.gradle index 47045bb577e..6e41c14fece 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/build.gradle +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/build.gradle @@ -14,7 +14,7 @@ ext { buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50" // $kotlin_version @@ -23,7 +23,7 @@ buildscript { } repositories { - jcenter() + mavenCentral() } kotlin { diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar b/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar index 2c6137b8789..7454180f2ae 100644 Binary files a/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar and b/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties b/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties index ce3ca77db54..ffed3a254e9 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue May 17 23:08:05 CST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew b/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew old mode 100644 new mode 100755 index 9d82f789151..1b6c787337f --- a/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew @@ -1,74 +1,129 @@ -#!/usr/bin/env bash +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -77,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -85,76 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew.bat b/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew.bat index 5f192121eb4..107acd32c4e 100644 --- a/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew.bat +++ b/samples/openapi3/client/petstore/kotlin-multiplatform/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/samples/openapi3/client/petstore/python/petstore_api/configuration.py b/samples/openapi3/client/petstore/python/petstore_api/configuration.py index 9042d98826a..44b3f666ac2 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/configuration.py +++ b/samples/openapi3/client/petstore/python/petstore_api/configuration.py @@ -262,6 +262,9 @@ conf = petstore_api.Configuration( self.proxy = None """Proxy URL """ + self.no_proxy = None + """bypass proxy for host in the no_proxy list. + """ self.proxy_headers = None """Proxy headers """ diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py index a38fcec1c84..476138a6bc8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py @@ -14,8 +14,10 @@ import logging import re import ssl from urllib.parse import urlencode - +from urllib.parse import urlparse +from urllib.request import proxy_bypass_environment import urllib3 +import ipaddress from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError @@ -72,7 +74,7 @@ class RESTClientObject(object): maxsize = 4 # https pool manager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''): self.pool_manager = urllib3.ProxyManager( num_pools=pools_size, maxsize=maxsize, @@ -290,3 +292,55 @@ class RESTClientObject(object): _preload_content=_preload_content, _request_timeout=_request_timeout, body=body) + +# end of class RESTClientObject +def is_ipv4(target): + """ Test if IPv4 address or not + """ + try: + chk = ipaddress.IPv4Address(target) + return True + except ipaddress.AddressValueError: + return False + +def in_ipv4net(target, net): + """ Test if target belongs to given IPv4 network + """ + try: + nw = ipaddress.IPv4Network(net) + ip = ipaddress.IPv4Address(target) + if ip in nw: + return True + return False + except ipaddress.AddressValueError: + return False + except ipaddress.NetmaskValueError: + return False + +def should_bypass_proxies(url, no_proxy=None): + """ Yet another requests.should_bypass_proxies + Test if proxies should not be used for a particular url. + """ + + parsed = urlparse(url) + + # special cases + if parsed.hostname in [None, '']: + return True + + # special cases + if no_proxy in [None , '']: + return False + if no_proxy == '*': + return True + + no_proxy = no_proxy.lower().replace(' ',''); + entries = ( + host for host in no_proxy.split(',') if host + ) + + if is_ipv4(parsed.hostname): + for item in entries: + if in_ipv4net(parsed.hostname, item): + return True + return proxy_bypass_environment(parsed.hostname, {'no': no_proxy} ) diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py b/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py index 5bf6b989ebe..9e49b9e71ba 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_extra_pool_config_options.py @@ -48,9 +48,9 @@ class TestExtraOptionsForPools(unittest.TestCase): socket_options = ["extra", "socket", "options"] - config = petstore_api.Configuration(host="HOST") + config = petstore_api.Configuration(host="http://somehost.local:8080") config.socket_options = socket_options - config.proxy = True + config.proxy = "http://proxy.local:8080/" with patch("petstore_api.rest.urllib3.ProxyManager", StubProxyManager): api_client = petstore_api.ApiClient(config) diff --git a/samples/openapi3/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/openapi3/server/petstore/kotlin-springboot-reactive/build.gradle.kts index 682bfec8aa1..46cdd62a58f 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/openapi3/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "org.openapitools" version = "1.0.0" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/samples/openapi3/server/petstore/kotlin-springboot/build.gradle.kts b/samples/openapi3/server/petstore/kotlin-springboot/build.gradle.kts index 49fe9400f70..2b99799bd53 100644 --- a/samples/openapi3/server/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/openapi3/server/petstore/kotlin-springboot/build.gradle.kts @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "org.openapitools" version = "1.0.0" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java index 859109086a5..3f538dd91f3 100644 --- a/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java +++ b/samples/server/petstore/java-undertow/src/main/java/org/openapitools/handler/PathHandlerInterface.java @@ -539,10 +539,10 @@ public interface PathHandlerInterface { *

Response headers: [CodegenProperty{openApiType='integer', baseName='X-Rate-Limit', complexType='null', getter='getxRateLimit', setter='setxRateLimit', description='calls per hour allowed by the user', dataType='Integer', datatypeWithEnum='Integer', dataFormat='int32', name='xRateLimit', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Rate-Limit;', baseType='Integer', containerType='null', title='null', unescapedDescription='calls per hour allowed by the user', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{ "type" : "integer", "format" : "int32" -}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{ +}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=true, isModel=false, isContainer=false, isString=false, isNumeric=true, isInteger=true, isShort=true, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=false, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XRateLimit', nameInSnakeCase='X_RATE_LIMIT', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false}, CodegenProperty{openApiType='string', baseName='X-Expires-After', complexType='Date', getter='getxExpiresAfter', setter='setxExpiresAfter', description='date in UTC when token expires', dataType='Date', datatypeWithEnum='Date', dataFormat='date-time', name='xExpiresAfter', min='null', max='null', defaultValue='null', defaultValueWithParam=' = data.X-Expires-After;', baseType='Date', containerType='null', title='null', unescapedDescription='date in UTC when token expires', maxLength=null, minLength=null, pattern='null', example='null', jsonSchema='{ "type" : "string", "format" : "date-time" -}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false}]

+}', minimum='null', maximum='null', exclusiveMinimum=false, exclusiveMaximum=false, required=false, deprecated=false, hasMoreNonReadOnly=false, isPrimitiveType=false, isModel=false, isContainer=false, isString=false, isNumeric=false, isInteger=false, isShort=false, isLong=false, isUnboundedInteger=false, isNumber=false, isFloat=false, isDouble=false, isDecimal=false, isByteArray=false, isBinary=false, isFile=false, isBoolean=false, isDate=false, isDateTime=true, isUuid=false, isUri=false, isEmail=false, isFreeFormObject=false, isArray=false, isMap=false, isEnum=false, isReadOnly=false, isWriteOnly=false, isNullable=false, isSelfReference=false, isCircularReference=false, isDiscriminator=false, _enum=null, allowableValues=null, items=null, additionalProperties=null, vars=[], requiredVars=[], mostInnerItems=null, vendorExtensions={}, hasValidation=false, isInherited=false, discriminatorValue='null', nameInCamelCase='XExpiresAfter', nameInSnakeCase='X_EXPIRES_AFTER', enumName='null', maxItems=null, minItems=null, maxProperties=null, minProperties=null, uniqueItems=false, multipleOf=null, isXmlAttribute=false, xmlPrefix='null', xmlName='null', xmlNamespace='null', isXmlWrapped=false, isNull=false, getAdditionalPropertiesIsAnyType=false, getHasVars=false, getHasRequired=false, getHasDiscriminatorWithNonEmptyMapping=false, composedSchemas=null, hasMultipleTypes=false}]

* *

Produces: [{mediaType=application/xml}, {mediaType=application/json}]

*

Returns: {@link String}

diff --git a/samples/server/petstore/kotlin-springboot-delegate/build.gradle.kts b/samples/server/petstore/kotlin-springboot-delegate/build.gradle.kts index d0e767d84cd..ea7f93398da 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-delegate/build.gradle.kts @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "org.openapitools" version = "1.0.0" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts b/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts index 49fe9400f70..2b99799bd53 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-modelMutable/build.gradle.kts @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "org.openapitools" version = "1.0.0" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES index e48401e8ff4..fdc7a16af74 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES @@ -4,13 +4,13 @@ pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt src/main/kotlin/org/openapitools/api/ApiUtil.kt -src/main/kotlin/org/openapitools/api/PetApi.kt +src/main/kotlin/org/openapitools/api/PetApiController.kt src/main/kotlin/org/openapitools/api/PetApiService.kt src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/StoreApi.kt +src/main/kotlin/org/openapitools/api/StoreApiController.kt src/main/kotlin/org/openapitools/api/StoreApiService.kt src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/UserApi.kt +src/main/kotlin/org/openapitools/api/UserApiController.kt src/main/kotlin/org/openapitools/api/UserApiService.kt src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt src/main/kotlin/org/openapitools/model/Category.kt diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts index 24ed63f61f8..2f35ba0681d 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "org.openapitools" version = "1.0.0" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt similarity index 100% rename from samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt rename to samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiController.kt diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt similarity index 100% rename from samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt rename to samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiController.kt diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt similarity index 100% rename from samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt rename to samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiController.kt diff --git a/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES index 612ea14bbdb..50a9d2bc75d 100644 --- a/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES @@ -5,13 +5,13 @@ settings.gradle src/main/kotlin/org/openapitools/Application.kt src/main/kotlin/org/openapitools/api/ApiUtil.kt src/main/kotlin/org/openapitools/api/Exceptions.kt -src/main/kotlin/org/openapitools/api/PetApi.kt +src/main/kotlin/org/openapitools/api/PetApiController.kt src/main/kotlin/org/openapitools/api/PetApiService.kt src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/StoreApi.kt +src/main/kotlin/org/openapitools/api/StoreApiController.kt src/main/kotlin/org/openapitools/api/StoreApiService.kt src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt -src/main/kotlin/org/openapitools/api/UserApi.kt +src/main/kotlin/org/openapitools/api/UserApiController.kt src/main/kotlin/org/openapitools/api/UserApiService.kt src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt src/main/kotlin/org/openapitools/model/Category.kt diff --git a/samples/server/petstore/kotlin-springboot/build.gradle.kts b/samples/server/petstore/kotlin-springboot/build.gradle.kts index d0e767d84cd..ea7f93398da 100644 --- a/samples/server/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot/build.gradle.kts @@ -2,8 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") @@ -14,8 +13,7 @@ group = "org.openapitools" version = "1.0.0" repositories { - jcenter() - maven { url = uri("https://repo1.maven.org/maven2") } + mavenCentral() } tasks.withType { diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt similarity index 100% rename from samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt rename to samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiController.kt diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiController.kt similarity index 100% rename from samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt rename to samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiController.kt diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiController.kt similarity index 100% rename from samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt rename to samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiController.kt