forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/5.4.x' into 6.0.x
This commit is contained in:
commit
4f2b5ee36d
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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|
|
||||
|
@ -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|<dl><dt>**joda**</dt><dd>Joda (for legacy app only)</dd><dt>**legacy**</dt><dd>Legacy java.util.Date (if you really have a good reason not to use threetenbp</dd><dt>**java8-localdatetime**</dt><dd>Java 8 using LocalDateTime (for legacy app only)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true</dd><dt>**threetenbp**</dt><dd>Backport of JSR310 (preferred for jdk < 1.8)</dd></dl>|threetenbp|
|
||||
|developerEmail|developer email in generated pom.xml| |team@openapitools.org|
|
||||
|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors|
|
||||
|
@ -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<CodegenProperty> allOf;
|
||||
private List<CodegenProperty> oneOf;
|
||||
private List<CodegenProperty> anyOf;
|
||||
|
||||
public CodegenComposedSchemas(List<CodegenProperty> allOf, List<CodegenProperty> oneOf, List<CodegenProperty> anyOf) {
|
||||
this.allOf = allOf;
|
||||
this.oneOf = oneOf;
|
||||
this.anyOf = anyOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getAllOf() {
|
||||
return allOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> getOneOf() {
|
||||
return oneOf;
|
||||
}
|
||||
|
||||
public List<CodegenProperty> 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);
|
||||
}
|
||||
}
|
@ -49,11 +49,6 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
public Set<String> oneOf = new TreeSet<String>();
|
||||
public Set<String> allOf = new TreeSet<String>();
|
||||
|
||||
// anyOf, oneOf, allOf with full properties/tags (e.g. isString, etc)
|
||||
public List<CodegenProperty> anyOfProps = new ArrayList<>();
|
||||
public List<CodegenProperty> allOfProps = new ArrayList<>();
|
||||
public List<CodegenProperty> 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<String, Object> vendorExtensions = new HashMap<String, Object>();
|
||||
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();
|
||||
}
|
||||
|
@ -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<String>(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; }
|
||||
}
|
||||
|
||||
|
@ -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<String, Object>(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);
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -2440,9 +2440,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
// interfaces (schemas defined in allOf, anyOf, oneOf)
|
||||
List<Schema> interfaces = ModelUtils.getInterfaces(composed);
|
||||
List<CodegenProperty> anyOfProps = new ArrayList<>();
|
||||
List<CodegenProperty> allOfProps = new ArrayList<>();
|
||||
List<CodegenProperty> 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<CodegenProperty> getComposedProperties(List<Schema> xOfCollection, String collectionName) {
|
||||
if (xOfCollection == null) {
|
||||
return null;
|
||||
}
|
||||
List<CodegenProperty> 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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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<String> parentModels = new HashSet<>();
|
||||
private final Multimap<String, CodegenModel> 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<String>(
|
||||
@ -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\"";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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<String, Object> operations) {
|
||||
Map<String, Object> _operations = (Map<String, Object>) operations.get("operations");
|
||||
List<ExtendedCodegenOperation> operationList = (List<ExtendedCodegenOperation>) _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();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<ObjectMapper> {
|
||||
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);
|
||||
|
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -43,7 +43,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
@ -63,7 +63,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
@ -91,16 +91,14 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
@ -108,11 +106,10 @@
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
@ -145,14 +142,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
{{#java8}}
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
{{/java8}}
|
||||
{{^java8}}
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
{{/java8}}
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<fork>true</fork>
|
||||
<meminitial>128m</meminitial>
|
||||
<maxmem>512m</maxmem>
|
||||
@ -165,7 +156,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@ -176,12 +167,7 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
{{#java8}}
|
||||
<source>1.8</source>
|
||||
{{/java8}}
|
||||
{{^java8}}
|
||||
<source>1.7</source>
|
||||
{{/java8}}
|
||||
<source>1.8</source>
|
||||
<tags>
|
||||
<tag>
|
||||
<name>http.response.details</name>
|
||||
@ -194,7 +180,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
@ -305,13 +291,11 @@
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/joda}}
|
||||
{{#java8}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{/java8}}
|
||||
{{#threetenbp}}
|
||||
<dependency>
|
||||
<groupId>com.github.joschi.jackson</groupId>
|
||||
@ -319,14 +303,6 @@
|
||||
<version>${threetenbp-version}</version>
|
||||
</dependency>
|
||||
{{/threetenbp}}
|
||||
{{^java8}}
|
||||
<!-- Base64 encoding that works in both JVM and Android -->
|
||||
<dependency>
|
||||
<groupId>com.brsanthu</groupId>
|
||||
<artifactId>migbase64</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
{{/java8}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
<dependency>
|
||||
<groupId>org.tomitribe</groupId>
|
||||
@ -388,7 +364,7 @@
|
||||
<http-signature-version>1.7</http-signature-version>
|
||||
{{/hasHttpSignatureMethods}}
|
||||
{{#hasOAuthMethods}}
|
||||
<scribejava-apis-version>6.9.0</scribejava-apis-version>
|
||||
<scribejava-apis-version>8.3.1</scribejava-apis-version>
|
||||
{{/hasOAuthMethods}}
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -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}} {
|
||||
|
@ -77,7 +77,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.microprofile.rest.client</groupId>
|
||||
<artifactId>microprofile-rest-client-api</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JAX-RS -->
|
||||
@ -189,7 +189,7 @@
|
||||
{{/useBeanValidation}}
|
||||
<cxf-version>3.2.7</cxf-version>
|
||||
<jackson-jaxrs-version>2.9.7</jackson-jaxrs-version>
|
||||
<jakarta.activation-version>1.2.2</jakarta.activation-version>
|
||||
<jakarta.activation-version>1.2.2</jakarta.activation-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<jakarta.json.bind-version>1.0.2</jakarta.json.bind-version>
|
||||
<jakarta.json-version>1.1.6</jakarta.json-version>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,9 @@ import {{invokerPackage}}.auth.RetryingOAuth;
|
||||
import {{invokerPackage}}.auth.OAuthFlow;
|
||||
{{/hasOAuthMethods}}
|
||||
|
||||
/**
|
||||
* <p>ApiClient class.</p>
|
||||
*/
|
||||
public class ApiClient {
|
||||
|
||||
private String basePath = "{{{basePath}}}";
|
||||
@ -100,7 +103,7 @@ public class ApiClient {
|
||||
private Map<String, ApiOperation> 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<String, String> 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<String, String> 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<String, String> 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||
*
|
||||
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||
*/
|
||||
public KeyManager[] getKeyManagers() {
|
||||
return keyManagers;
|
||||
}
|
||||
@ -353,15 +363,32 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||
*
|
||||
* @return a {@link java.text.DateFormat} object
|
||||
*/
|
||||
public DateFormat getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set SqlDateFormat.</p>
|
||||
*
|
||||
* @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}}
|
||||
/**
|
||||
* <p>Set OffsetDateTimeFormat.</p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set LocalDateFormat.</p>
|
||||
*
|
||||
* @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}}
|
||||
/**
|
||||
* <p>Set LenientOnJson.</p>
|
||||
*
|
||||
* @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 <T> 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 <T> ApiResponse<T> 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 <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||
try {
|
||||
@ -1124,6 +1169,14 @@ public class ApiClient {
|
||||
}
|
||||
|
||||
{{#supportStreaming}}
|
||||
/**
|
||||
* <p>Execute stream.</p>
|
||||
*
|
||||
* @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> 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<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> 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<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
@ -11,8 +11,6 @@ import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* API response returned by API call.
|
||||
*
|
||||
* @param <T> The type of data that is deserialized from response body
|
||||
*/
|
||||
public class ApiResponse<T> {
|
||||
final private int statusCode;
|
||||
@ -20,6 +18,8 @@ public class ApiResponse<T> {
|
||||
final private T data;
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiResponse.</p>
|
||||
*
|
||||
* @param statusCode The status code of HTTP response
|
||||
* @param headers The headers of HTTP response
|
||||
*/
|
||||
@ -28,6 +28,8 @@ public class ApiResponse<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiResponse.</p>
|
||||
*
|
||||
* @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<T> {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the <code>status code</code>.</p>
|
||||
*
|
||||
* @return the status code
|
||||
*/
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the <code>headers</code>.</p>
|
||||
*
|
||||
* @return a {@link java.util.Map} of headers
|
||||
*/
|
||||
public Map<String, List<String>> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the <code>data</code>.</p>
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -9,22 +9,47 @@ import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
{{/caseInsensitiveResponseHeaders}}
|
||||
|
||||
/**
|
||||
* <p>ApiException class.</p>
|
||||
*/
|
||||
{{>generatedAnnotation}}
|
||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
private String responseBody = null;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*/
|
||||
public ApiException() {}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @param throwable a {@link java.lang.Throwable} object
|
||||
*/
|
||||
public ApiException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @param message the error message
|
||||
*/
|
||||
public ApiException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
super(message, throwable);
|
||||
this.code = code;
|
||||
@ -38,23 +63,60 @@ public class ApiException extends{{#useRuntimeException}} RuntimeException {{/us
|
||||
this.responseBody = responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders) {
|
||||
this(message, throwable, code, responseHeaders, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @param code HTTP status code
|
||||
* @param message a {@link java.lang.String} object
|
||||
*/
|
||||
public ApiException(int code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
this(code, message);
|
||||
{{#caseInsensitiveResponseHeaders}}
|
||||
|
@ -57,7 +57,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
@ -77,7 +77,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
@ -104,16 +104,14 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
@ -121,11 +119,10 @@
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
@ -156,7 +153,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@ -179,7 +176,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
@ -200,7 +197,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@ -278,7 +275,7 @@
|
||||
<dependency>
|
||||
<groupId>io.swagger.parser.v3</groupId>
|
||||
<artifactId>swagger-parser-v3</artifactId>
|
||||
<version>2.0.23</version>
|
||||
<version>2.0.28</version>
|
||||
</dependency>
|
||||
{{/dynamicOperations}}
|
||||
{{#useBeanValidation}}
|
||||
@ -295,7 +292,7 @@
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>5.4.1.Final</version>
|
||||
<version>5.4.3.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.el</groupId>
|
||||
@ -335,19 +332,19 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<version>3.12.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.5</gson-fire-version>
|
||||
<swagger-core-version>1.6.2</swagger-core-version>
|
||||
<okhttp-version>4.9.1</okhttp-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<commons-lang3-version>3.11</commons-lang3-version>
|
||||
<swagger-core-version>1.6.3</swagger-core-version>
|
||||
<okhttp-version>4.9.2</okhttp-version>
|
||||
<gson-version>2.8.8</gson-version>
|
||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||
{{#openApiNullable}}
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
{{/openApiNullable}}
|
||||
@ -362,9 +359,9 @@
|
||||
<jakarta.el-version>3.0.3</jakarta.el-version>
|
||||
{{/performBeanValidation}}
|
||||
{{#useBeanValidation}}
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
<beanvalidation-version>2.0.2</beanvalidation-version>
|
||||
{{/useBeanValidation}}
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 <boost/optional.hpp>
|
||||
|
||||
{{#apiNamespaceDeclarations}}
|
||||
|
5
modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache
vendored
Normal file
5
modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/cmake-config.mustache
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
|
||||
|
||||
check_required_components("@PROJECT_NAME@")
|
@ -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
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
|
||||
-Wall -Wno-unused-variable>
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
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}
|
||||
)
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
{{^parent}}
|
||||
{{{defaultInclude}}}
|
||||
#include "../ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
{{/parent}}
|
||||
|
||||
{{#imports}}{{{this}}}
|
||||
|
@ -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
|
||||
|
@ -1,2 +0,0 @@
|
||||
--color
|
||||
--require spec_helper
|
@ -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
|
@ -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}}
|
||||
|
@ -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<KotlinCompile> {
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
"""
|
||||
|
@ -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} )
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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}}
|
||||
|
@ -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}}
|
||||
|
@ -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}}
|
||||
|
@ -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));
|
||||
|
@ -105,12 +105,17 @@ export function *{{nickname}}SagaImp(_action_: Action<Payload{{#lambda.titlecase
|
||||
|
||||
yield put({{nickname}}Request({{#allParams.0}}{{#returnTypeSupportsEntities}}requestPayload{{/returnTypeSupportsEntities}}{{^returnTypeSupportsEntities}}_action_.payload{{/returnTypeSupportsEntities}}{{/allParams.0}}));
|
||||
|
||||
const response{{#returnType}}: Required<{{{.}}}>{{/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}},
|
||||
|
@ -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)"
|
||||
);
|
||||
}
|
||||
|
@ -50,4 +50,4 @@ public class MarkdownSampleGeneratorTest {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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<File> 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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
70
pom.xml
70
pom.xml
@ -1172,7 +1172,6 @@
|
||||
</property>
|
||||
</activation>
|
||||
<modules>
|
||||
<module>samples/server/petstore/kotlin-springboot</module>
|
||||
<module>samples/server/petstore/jaxrs/jersey2</module>
|
||||
<module>samples/server/petstore/jaxrs/jersey2-useTags</module>
|
||||
<module>samples/server/petstore/spring-mvc</module>
|
||||
@ -1230,7 +1229,6 @@
|
||||
<module>samples/server/petstore/scala-akka-http-server</module>
|
||||
<module>samples/server/petstore/scalatra</module>
|
||||
<module>samples/server/petstore/scala-finch</module>
|
||||
<!--<module>samples/server/petstore/kotlin/vertx</module>-->
|
||||
</modules>
|
||||
</profile>
|
||||
<!-- node 3 tests in CircleCI -->
|
||||
@ -1247,6 +1245,33 @@
|
||||
<module>samples/client/petstore/python</module>
|
||||
<module>samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent</module>
|
||||
<module>samples/openapi3/client/petstore/python</module>
|
||||
<!-- TODO comment out below when the test for typescript-nestjs is ready
|
||||
<module>samples/client/petstore/typescript-nestjs-v6-provided-in-root</module>-->
|
||||
<!-- comment out due to error `npm run build`
|
||||
<module>samples/client/petstore/typescript-jquery/npm</module>-->
|
||||
<module>samples/client/petstore/typescript-angular-v7-provided-in-root</module>
|
||||
<module>samples/client/petstore/typescript-angular-v11-provided-in-root</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/default</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/default</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/jquery</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/jquery</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/object_params</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/object_params</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/inversify</module>
|
||||
<!-- comment out due to failure in travis ci
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/inversify</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/deno</module>-->
|
||||
<module>samples/client/petstore/typescript-fetch/builds/default</module>
|
||||
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
|
||||
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-fetch/tests/default</module>
|
||||
<module>samples/client/petstore/typescript-node/npm</module>
|
||||
<module>samples/client/petstore/typescript-rxjs/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-axios/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-axios/tests/default</module>
|
||||
<module>samples/client/petstore/javascript-flowtyped</module>
|
||||
<module>samples/client/petstore/javascript-es6</module>
|
||||
<module>samples/client/petstore/javascript-promise-es6</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<!-- other tests in CircleCI -->
|
||||
@ -1290,39 +1315,6 @@
|
||||
<module>samples/client/petstore/java/microprofile-rest-client</module>
|
||||
<module>samples/client/petstore/java/apache-httpclient</module>
|
||||
<module>samples/client/petstore/groovy</module>
|
||||
<!-- test non-java projects -->
|
||||
<module>samples/client/petstore/go</module>
|
||||
<module>samples/openapi3/client/petstore/go</module>
|
||||
<module>samples/client/petstore/javascript-flowtyped</module>
|
||||
<module>samples/client/petstore/javascript-es6</module>
|
||||
<module>samples/client/petstore/javascript-promise-es6</module>
|
||||
<module>samples/server/petstore/go-api-server</module>
|
||||
<module>samples/server/petstore/go-gin-api-server</module>
|
||||
<module>samples/server/petstore/go-echo-server</module>
|
||||
<!-- TODO comment out below when the test for typescript-nestjs is ready
|
||||
<module>samples/client/petstore/typescript-nestjs-v6-provided-in-root</module>-->
|
||||
<!-- comment out due to error `npm run build`
|
||||
<module>samples/client/petstore/typescript-jquery/npm</module>-->
|
||||
<module>samples/client/petstore/typescript-angular-v7-provided-in-root</module>
|
||||
<module>samples/client/petstore/typescript-angular-v11-provided-in-root</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/default</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/default</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/jquery</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/jquery</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/object_params</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/object_params</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/builds/inversify</module>
|
||||
<!-- comment out due to failure in travis ci
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/inversify</module>
|
||||
<module>samples/openapi3/client/petstore/typescript/tests/deno</module>-->
|
||||
<module>samples/client/petstore/typescript-fetch/builds/default</module>
|
||||
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
|
||||
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-fetch/tests/default</module>
|
||||
<module>samples/client/petstore/typescript-node/npm</module>
|
||||
<module>samples/client/petstore/typescript-rxjs/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-axios/builds/with-npm-version</module>
|
||||
<module>samples/client/petstore/typescript-axios/tests/default</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<!-- test with JDK9 in Shippable CI -->
|
||||
@ -1356,6 +1348,8 @@
|
||||
<module>samples/client/petstore/kotlin-threetenbp</module>
|
||||
<module>samples/client/petstore/kotlin-uppercase-enum</module>
|
||||
<!-- servers -->
|
||||
<module>samples/server/petstore/kotlin-springboot</module>
|
||||
<!--<module>samples/server/petstore/kotlin/vertx</module>-->
|
||||
<!--<module>samples/server/petstore/erlang-server</module>-->
|
||||
</modules>
|
||||
</profile>
|
||||
@ -1388,6 +1382,12 @@
|
||||
<!--<module>samples/client/petstore/haskell-http-client</module>-->
|
||||
<!-- servers -->
|
||||
<!--<module>samples/server/petstore/haskell-servant</module>-->
|
||||
<!-- test Go projects -->
|
||||
<module>samples/client/petstore/go</module>
|
||||
<module>samples/openapi3/client/petstore/go</module>
|
||||
<module>samples/server/petstore/go-api-server</module>
|
||||
<module>samples/server/petstore/go-gin-api-server</module>
|
||||
<module>samples/server/petstore/go-echo-server</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
@ -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
|
||||
|
@ -50,7 +50,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-maven</id>
|
||||
@ -70,7 +70,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M4</version>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
@ -97,16 +97,14 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- attach test jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
@ -114,11 +112,10 @@
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.10</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add_sources</id>
|
||||
@ -149,7 +146,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@ -172,7 +169,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
@ -193,7 +190,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>3.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
@ -272,23 +269,23 @@
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<version>3.12.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<java.version>1.7</java.version>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<gson-fire-version>1.8.5</gson-fire-version>
|
||||
<swagger-core-version>1.6.2</swagger-core-version>
|
||||
<okhttp-version>4.9.1</okhttp-version>
|
||||
<gson-version>2.8.6</gson-version>
|
||||
<commons-lang3-version>3.11</commons-lang3-version>
|
||||
<swagger-core-version>1.6.3</swagger-core-version>
|
||||
<okhttp-version>4.9.2</okhttp-version>
|
||||
<gson-version>2.8.8</gson-version>
|
||||
<commons-lang3-version>3.12.0</commons-lang3-version>
|
||||
<jackson-databind-nullable-version>0.2.1</jackson-databind-nullable-version>
|
||||
<threetenbp-version>1.5.0</threetenbp-version>
|
||||
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||
<junit-version>4.13.1</junit-version>
|
||||
<junit-version>4.13.2</junit-version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -54,6 +54,9 @@ import org.openapitools.client.auth.HttpBasicAuth;
|
||||
import org.openapitools.client.auth.HttpBearerAuth;
|
||||
import org.openapitools.client.auth.ApiKeyAuth;
|
||||
|
||||
/**
|
||||
* <p>ApiClient class.</p>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>keyManagers</code>.</p>
|
||||
*
|
||||
* @return an array of {@link javax.net.ssl.KeyManager} objects
|
||||
*/
|
||||
public KeyManager[] getKeyManagers() {
|
||||
return keyManagers;
|
||||
}
|
||||
@ -251,30 +261,65 @@ public class ApiClient {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>dateFormat</code>.</p>
|
||||
*
|
||||
* @return a {@link java.text.DateFormat} object
|
||||
*/
|
||||
public DateFormat getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>dateFormat</code>.</p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set SqlDateFormat.</p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set OffsetDateTimeFormat.</p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set LocalDateFormat.</p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set LenientOnJson.</p>
|
||||
*
|
||||
* @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 <T> 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 <T> ApiResponse<T> 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 <T> ApiResponse<T> execute(Call call, Type returnType) throws ApiException {
|
||||
try {
|
||||
@ -927,6 +972,14 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Execute stream.</p>
|
||||
*
|
||||
* @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> 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<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> 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<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||
|
@ -16,22 +16,47 @@ package org.openapitools.client;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>ApiException class.</p>
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ApiException extends Exception {
|
||||
private int code = 0;
|
||||
private Map<String, List<String>> responseHeaders = null;
|
||||
private String responseBody = null;
|
||||
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*/
|
||||
public ApiException() {}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @param throwable a {@link java.lang.Throwable} object
|
||||
*/
|
||||
public ApiException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @param message the error message
|
||||
*/
|
||||
public ApiException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
super(message, throwable);
|
||||
this.code = code;
|
||||
@ -39,23 +64,60 @@ public class ApiException extends Exception {
|
||||
this.responseBody = responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders) {
|
||||
this(message, throwable, code, responseHeaders, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
this((String) null, (Throwable) null, code, responseHeaders, responseBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @param code HTTP status code
|
||||
* @param message a {@link java.lang.String} object
|
||||
*/
|
||||
public ApiException(int code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiException.</p>
|
||||
*
|
||||
* @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<String, List<String>> responseHeaders, String responseBody) {
|
||||
this(code, message);
|
||||
this.responseHeaders = responseHeaders;
|
||||
|
@ -18,8 +18,6 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* API response returned by API call.
|
||||
*
|
||||
* @param <T> The type of data that is deserialized from response body
|
||||
*/
|
||||
public class ApiResponse<T> {
|
||||
final private int statusCode;
|
||||
@ -27,6 +25,8 @@ public class ApiResponse<T> {
|
||||
final private T data;
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiResponse.</p>
|
||||
*
|
||||
* @param statusCode The status code of HTTP response
|
||||
* @param headers The headers of HTTP response
|
||||
*/
|
||||
@ -35,6 +35,8 @@ public class ApiResponse<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Constructor for ApiResponse.</p>
|
||||
*
|
||||
* @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<T> {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the <code>status code</code>.</p>
|
||||
*
|
||||
* @return the status code
|
||||
*/
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the <code>headers</code>.</p>
|
||||
*
|
||||
* @return a {@link java.util.Map} of headers
|
||||
*/
|
||||
public Map<String, List<String>> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Get the <code>data</code>.</p>
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -6,6 +6,7 @@ ApiConfiguration.h
|
||||
ApiException.cpp
|
||||
ApiException.h
|
||||
CMakeLists.txt
|
||||
Config.cmake.in
|
||||
HttpContent.cpp
|
||||
HttpContent.h
|
||||
IHttpBody.h
|
||||
|
@ -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
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
|
||||
-Wall -Wno-unused-variable>
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
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}
|
||||
)
|
||||
|
@ -0,0 +1,5 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake)
|
||||
|
||||
check_required_components("@PROJECT_NAME@")
|
@ -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 <cpprest/details/basic_types.h>
|
||||
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
|
@ -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 <map>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
|
@ -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 <vector>
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace org {
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_ApiResponse_H_
|
||||
|
||||
|
||||
#include "../ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_Category_H_
|
||||
|
||||
|
||||
#include "../ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_Order_H_
|
||||
|
||||
|
||||
#include "../ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <cpprest/details/basic_types.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 <cpprest/details/basic_types.h>
|
||||
#include "Category.h"
|
||||
#include <vector>
|
||||
#include "model/Category.h"
|
||||
|
||||
namespace org {
|
||||
namespace openapitools {
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_Tag_H_
|
||||
|
||||
|
||||
#include "../ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define ORG_OPENAPITOOLS_CLIENT_MODEL_User_H_
|
||||
|
||||
|
||||
#include "../ModelBase.h"
|
||||
#include "ModelBase.h"
|
||||
|
||||
#include <cpprest/details/basic_types.h>
|
||||
|
||||
|
45
samples/client/petstore/crystal/.gitignore
vendored
45
samples/client/petstore/crystal/.gitignore
vendored
@ -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
|
||||
|
@ -1,2 +0,0 @@
|
||||
--color
|
||||
--require spec_helper
|
@ -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
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
0
samples/client/petstore/java/feign-no-nullable/gradlew
vendored
Normal file → Executable file
0
samples/client/petstore/java/feign-no-nullable/gradlew
vendored
Normal file → Executable file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
}
|
||||
|
Binary file not shown.
@ -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
|
||||
|
269
samples/client/petstore/java/feign/feign10x/gradlew
vendored
Normal file → Executable file
269
samples/client/petstore/java/feign/feign10x/gradlew
vendored
Normal file → Executable file
@ -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" "$@"
|
||||
|
@ -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
|
||||
|
0
samples/client/petstore/java/feign/gradlew
vendored
Normal file → Executable file
0
samples/client/petstore/java/feign/gradlew
vendored
Normal file → Executable file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
0
samples/client/petstore/java/google-api-client/gradlew
vendored
Normal file → Executable file
0
samples/client/petstore/java/google-api-client/gradlew
vendored
Normal file → Executable file
@ -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 {
|
||||
|
@ -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"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user