mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-31 14:00:54 +00:00
Merge branch 'master' of https://github.com/OpenAPITools/openapi-generator
This commit is contained in:
commit
a3566cd34f
@ -671,6 +671,40 @@ public class ApiClient {
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the specified collection path parameter to a string value.
|
||||
*
|
||||
* @param collectionFormat The collection format of the parameter.
|
||||
* @param value The value of the parameter.
|
||||
* @return String representation of the parameter
|
||||
*/
|
||||
public String collectionPathParameterToString(String collectionFormat, Collection value) {
|
||||
// create the value based on the collection format
|
||||
if ("multi".equals(collectionFormat)) {
|
||||
// not valid for path params
|
||||
return parameterToString(value);
|
||||
}
|
||||
|
||||
// collectionFormat is assumed to be "csv" by default
|
||||
String delimiter = ",";
|
||||
|
||||
if ("ssv".equals(collectionFormat)) {
|
||||
delimiter = " ";
|
||||
} else if ("tsv".equals(collectionFormat)) {
|
||||
delimiter = "\t";
|
||||
} else if ("pipes".equals(collectionFormat)) {
|
||||
delimiter = "|";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder() ;
|
||||
for (Object item : value) {
|
||||
sb.append(delimiter);
|
||||
sb.append(parameterToString(item));
|
||||
}
|
||||
|
||||
return sb.substring(delimiter.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize filename by removing path.
|
||||
* e.g. ../../sun.gif becomes sun.gif
|
||||
|
@ -86,7 +86,7 @@ public class {{classname}} {
|
||||
|
||||
// create path and map variables
|
||||
String localVarPath = "{{{path}}}"{{#pathParams}}
|
||||
.replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{{paramName}}}.toString())){{/pathParams}};
|
||||
.replaceAll("\\{" + "{{baseName}}" + "\\}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}};
|
||||
|
||||
{{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
|
||||
{{javaUtilPrefix}}List<Pair> localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
|
||||
|
@ -236,6 +236,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
{{/hasBodyParam}}
|
||||
{{#authMethods}}
|
||||
{{#isApiKey}}
|
||||
{{^isKeyInCookie}}
|
||||
if ctx != nil {
|
||||
// API Key Authentication
|
||||
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
|
||||
@ -253,7 +254,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
|
||||
{{/isKeyInQuery}}
|
||||
}
|
||||
}
|
||||
|
||||
{{/isKeyInCookie}}
|
||||
{{/isApiKey}}
|
||||
{{/authMethods}}
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
|
||||
|
@ -31,13 +31,15 @@ _without publishing (not recommended):_
|
||||
|
||||
```
|
||||
{{#useNgPackagr}}
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
{{/useNgPackagr}}
|
||||
{{^useNgPackagr}}
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/{{npmName}}-{{npmVersion}}.tgz --save
|
||||
{{/useNgPackagr}}
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
{{#useNgPackagr}}
|
||||
|
@ -18,8 +18,7 @@
|
||||
"module": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "ngc",
|
||||
"postinstall": "npm run build"
|
||||
"build": "ngc && npm pack"
|
||||
},
|
||||
{{/useNgPackagr}}
|
||||
"peerDependencies": {
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -637,6 +637,40 @@ public class ApiClient {
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the specified collection path parameter to a string value.
|
||||
*
|
||||
* @param collectionFormat The collection format of the parameter.
|
||||
* @param value The value of the parameter.
|
||||
* @return String representation of the parameter
|
||||
*/
|
||||
public String collectionPathParameterToString(String collectionFormat, Collection value) {
|
||||
// create the value based on the collection format
|
||||
if ("multi".equals(collectionFormat)) {
|
||||
// not valid for path params
|
||||
return parameterToString(value);
|
||||
}
|
||||
|
||||
// collectionFormat is assumed to be "csv" by default
|
||||
String delimiter = ",";
|
||||
|
||||
if ("ssv".equals(collectionFormat)) {
|
||||
delimiter = " ";
|
||||
} else if ("tsv".equals(collectionFormat)) {
|
||||
delimiter = "\t";
|
||||
} else if ("pipes".equals(collectionFormat)) {
|
||||
delimiter = "|";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder() ;
|
||||
for (Object item : value) {
|
||||
sb.append(delimiter);
|
||||
sb.append(parameterToString(item));
|
||||
}
|
||||
|
||||
return sb.substring(delimiter.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize filename by removing path.
|
||||
* e.g. ../../sun.gif becomes sun.gif
|
||||
|
@ -637,6 +637,40 @@ public class ApiClient {
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the specified collection path parameter to a string value.
|
||||
*
|
||||
* @param collectionFormat The collection format of the parameter.
|
||||
* @param value The value of the parameter.
|
||||
* @return String representation of the parameter
|
||||
*/
|
||||
public String collectionPathParameterToString(String collectionFormat, Collection value) {
|
||||
// create the value based on the collection format
|
||||
if ("multi".equals(collectionFormat)) {
|
||||
// not valid for path params
|
||||
return parameterToString(value);
|
||||
}
|
||||
|
||||
// collectionFormat is assumed to be "csv" by default
|
||||
String delimiter = ",";
|
||||
|
||||
if ("ssv".equals(collectionFormat)) {
|
||||
delimiter = " ";
|
||||
} else if ("tsv".equals(collectionFormat)) {
|
||||
delimiter = "\t";
|
||||
} else if ("pipes".equals(collectionFormat)) {
|
||||
delimiter = "|";
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder() ;
|
||||
for (Object item : value) {
|
||||
sb.append(delimiter);
|
||||
sb.append(parameterToString(item));
|
||||
}
|
||||
|
||||
return sb.substring(delimiter.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize filename by removing path.
|
||||
* e.g. ../../sun.gif becomes sun.gif
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/angular2-typescript-petstore@0.0.1 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/@swagger/angular2-typescript-petstore-0.0.1.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -12,8 +12,7 @@
|
||||
"module": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "ngc",
|
||||
"postinstall": "npm run build"
|
||||
"build": "ngc && npm pack"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "^2.0.0",
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/angular2-typescript-petstore@0.0.1 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/angular2-typescript-petstore@0.0.1 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/typescript-angular-petstore@1.0.0 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/typescript-angular-petstore@1.0.0 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/typescript-angular-petstore@1.0.0 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
@ -25,9 +25,11 @@ npm install @ --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/-.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE:
|
||||
|
@ -25,9 +25,11 @@ npm install @swagger/typescript-angular-petstore@1.0.0 --save
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist --save
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
Loading…
x
Reference in New Issue
Block a user