forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 6.0.x
This commit is contained in:
@@ -51,8 +51,10 @@ jobs:
|
||||
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
|
||||
nvm alias default stable
|
||||
#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
|
||||
|
||||
@@ -90,6 +90,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>float</li>
|
||||
<li>for</li>
|
||||
<li>formParams</li>
|
||||
<li>from</li>
|
||||
<li>function</li>
|
||||
<li>goto</li>
|
||||
<li>headerParams</li>
|
||||
|
||||
@@ -136,8 +136,9 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
|
||||
parentFolder.mkdirs();
|
||||
}
|
||||
|
||||
try (Writer writer = new BufferedWriter(
|
||||
new OutputStreamWriter(new FileOutputStream(out), StandardCharsets.UTF_8))) {
|
||||
try (FileOutputStream fileOutputStream = new FileOutputStream(out);
|
||||
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8);
|
||||
Writer writer = new BufferedWriter(outputStreamWriter)) {
|
||||
writer.write(sb.toString());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -51,7 +51,8 @@ public class ZipUtil {
|
||||
public void compressFiles(List<File> listFiles, String destZipFile)
|
||||
throws IOException {
|
||||
|
||||
try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(destZipFile))) {
|
||||
try (FileOutputStream fileOutputStream = new FileOutputStream(destZipFile);
|
||||
ZipOutputStream zos = new ZipOutputStream(fileOutputStream)) {
|
||||
|
||||
for (File file : listFiles) {
|
||||
if (file.isDirectory()) {
|
||||
@@ -84,7 +85,8 @@ public class ZipUtil {
|
||||
|
||||
zos.putNextEntry(new ZipEntry(parentFolder + "/" + file.getName()));
|
||||
|
||||
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) {
|
||||
try (FileInputStream fileInputStream = new FileInputStream(file);
|
||||
BufferedInputStream bis = new BufferedInputStream(fileInputStream)) {
|
||||
byte[] bytesIn = new byte[BUFFER_SIZE];
|
||||
int read;
|
||||
while ((read = bis.read(bytesIn)) != -1) {
|
||||
@@ -109,7 +111,8 @@ public class ZipUtil {
|
||||
IOException {
|
||||
zos.putNextEntry(new ZipEntry(file.getName()));
|
||||
|
||||
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file))) {
|
||||
try (FileInputStream fileInputStream = new FileInputStream(file);
|
||||
BufferedInputStream bis = new BufferedInputStream(fileInputStream)) {
|
||||
byte[] bytesIn = new byte[BUFFER_SIZE];
|
||||
int read;
|
||||
while ((read = bis.read(bytesIn)) != -1) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
|
||||
@@ -105,7 +105,9 @@ public class CodegenIgnoreProcessor {
|
||||
}
|
||||
|
||||
void loadCodegenRules(final File codegenIgnore) throws IOException {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(codegenIgnore), Charset.forName("UTF-8")))) {
|
||||
try (FileInputStream fileInputStream = new FileInputStream(codegenIgnore);
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
|
||||
BufferedReader reader = new BufferedReader(inputStreamReader)) {
|
||||
String line;
|
||||
|
||||
// NOTE: Comments that start with a : (e.g. //:) are pulled from git documentation for .gitignore
|
||||
|
||||
@@ -243,7 +243,8 @@ abstract public class AbstractRubyCodegen extends DefaultCodegen implements Code
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
try(BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8))) {
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8);
|
||||
BufferedReader br = new BufferedReader(inputStreamReader)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
|
||||
@@ -875,13 +875,15 @@ public class CrystalClientCodegen extends DefaultCodegen {
|
||||
Process p = Runtime.getRuntime().exec(command);
|
||||
int exitValue = p.waitFor();
|
||||
if (exitValue != 0) {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
try (InputStreamReader inputStreamReader = new InputStreamReader(p.getErrorStream(), StandardCharsets.UTF_8);
|
||||
BufferedReader br = new BufferedReader(inputStreamReader)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb.toString());
|
||||
}
|
||||
LOGGER.error("Error running the command ({}). Exit value: {}, Error output: {}", command, exitValue, sb.toString());
|
||||
} else {
|
||||
LOGGER.info("Successfully executed: {}", command);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
reservedWords.addAll(Arrays.asList(
|
||||
// local variable names used in API methods (endpoints)
|
||||
"varLocalPath", "queryParameters", "headerParams", "formParams", "useFormData", "varLocalDeferred",
|
||||
"requestOptions",
|
||||
"requestOptions", "from",
|
||||
// Typescript reserved words
|
||||
"abstract", "await", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", "with", "yield"));
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -120,8 +120,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export class {{classname}} {
|
||||
{{/withInterfaces}}
|
||||
|
||||
protected basePath = '{{{basePath}}}';
|
||||
public defaultHeaders = new Map()
|
||||
public defaultHeaders: Record<string,string> = {};
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
|
||||
1
pom.xml
1
pom.xml
@@ -183,7 +183,6 @@
|
||||
<argLine>@{argLine} -XX:+StartAttachListener</argLine>
|
||||
<forkCount>3</forkCount>
|
||||
<reuseForks>true</reuseForks>
|
||||
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
|
||||
<systemPropertyVariables>
|
||||
<org.openapitools.codegen.utils.oncelogger.expiry>1000</org.openapitools.codegen.utils.oncelogger.expiry>
|
||||
<org.openapitools.codegen.utils.oncelogger.cachesize>5000</org.openapitools.codegen.utils.oncelogger.cachesize>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import { Configuration } from "./configuration";
|
||||
import { RequiredError, RequestArgs } from "./base";
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosInstance, AxiosResponse } from 'axios';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -131,8 +131,8 @@ export const toPathString = function (url: URL) {
|
||||
* @export
|
||||
*/
|
||||
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
return axios.request<T, R>(axiosRequestArgs);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import { Configuration } from '../configuration';
|
||||
export class PetService {
|
||||
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
public defaultHeaders = new Map()
|
||||
public defaultHeaders: Record<string,string> = {};
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
|
||||
export class StoreService {
|
||||
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
public defaultHeaders = new Map()
|
||||
public defaultHeaders: Record<string,string> = {};
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
|
||||
export class UserService {
|
||||
|
||||
protected basePath = 'http://petstore.swagger.io/v2';
|
||||
public defaultHeaders = new Map()
|
||||
public defaultHeaders: Record<string,string> = {};
|
||||
public configuration = new Configuration();
|
||||
|
||||
constructor(protected httpClient: HttpService, @Optional() configuration: Configuration) {
|
||||
|
||||
Reference in New Issue
Block a user