Use unescaped path in API client templates (#5154)

* use unescaped path in api client templates

* use unescape basePath in API client templates
This commit is contained in:
wing328 2017-03-22 20:49:06 +08:00 committed by GitHub
parent a4d4b0f0bd
commit f064d29e82
38 changed files with 54 additions and 54 deletions

View File

@ -24,7 +24,7 @@ namespace {{packageName}}.Client
/// Initializes a new instance of the <see cref="ApiClient" /> class. /// Initializes a new instance of the <see cref="ApiClient" /> class.
/// </summary> /// </summary>
/// <param name="basePath">The base path.</param> /// <param name="basePath">The base path.</param>
public ApiClient(String basePath="{{basePath}}") public ApiClient(String basePath="{{{basePath}}}")
{ {
BasePath = basePath; BasePath = basePath;
RestClient = new RestClient(BasePath); RestClient = new RestClient(BasePath);

View File

@ -89,7 +89,7 @@ namespace {{packageName}}.Api
if ({{paramName}} == null) throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{nickname}}"); if ({{paramName}} == null) throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{nickname}}");
{{/required}}{{/allParams}} {{/required}}{{/allParams}}
var path = "{{path}}"; var path = "{{{path}}}";
path = path.Replace("{format}", "json"); path = path.Replace("{format}", "json");
{{#pathParams}}path = path.Replace("{" + "{{baseName}}" + "}", ApiClient.ParameterToString({{{paramName}}})); {{#pathParams}}path = path.Replace("{" + "{{baseName}}" + "}", ApiClient.ParameterToString({{{paramName}}}));
{{/pathParams}} {{/pathParams}}

View File

@ -13,13 +13,13 @@ import java.util.*;
@Mixin(ApiUtils) @Mixin(ApiUtils)
{{#operations}} {{#operations}}
class {{classname}} { class {{classname}} {
String basePath = "{{basePath}}" String basePath = "{{{basePath}}}"
String versionPath = "/api/v1" String versionPath = "/api/v1"
{{#operation}} {{#operation}}
def {{operationId}} ({{#allParams}} {{{dataType}}} {{paramName}},{{/allParams}} Closure onSuccess, Closure onFailure) { def {{operationId}} ({{#allParams}} {{{dataType}}} {{paramName}},{{/allParams}} Closure onSuccess, Closure onFailure) {
// create path and map path parameters (TODO) // create path and map path parameters (TODO)
String resourcePath = "{{path}}" String resourcePath = "{{{path}}}"
// query params // query params
def queryParams = [:] def queryParams = [:]

View File

@ -50,7 +50,7 @@ import {{invokerPackage}}.auth.OAuth;
{{>generatedAnnotation}} {{>generatedAnnotation}}
public class ApiClient { public class ApiClient {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>(); private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private String basePath = "{{basePath}}"; private String basePath = "{{{basePath}}}";
private boolean debugging = false; private boolean debugging = false;
private int connectionTimeout = 0; private int connectionTimeout = 0;

View File

@ -32,7 +32,7 @@ public interface {{classname}} {
*/ */
{{#formParams}}{{#-first}} {{#formParams}}{{#-first}}
{{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} {{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}}
@{{httpMethod}}("{{path}}") @{{httpMethod}}("{{{path}}}")
{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}} {{operationId}}({{^allParams}});{{/allParams}} {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}} {{operationId}}({{^allParams}});{{/allParams}}
{{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} {{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}
);{{/hasMore}}{{/allParams}} );{{/hasMore}}{{/allParams}}
@ -47,7 +47,7 @@ public interface {{classname}} {
*/ */
{{#formParams}}{{#-first}} {{#formParams}}{{#-first}}
{{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}} {{#isMultipart}}@retrofit.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit.http.FormUrlEncoded{{/isMultipart}}{{/-first}}{{/formParams}}
@{{httpMethod}}("{{path}}") @{{httpMethod}}("{{{path}}}")
void {{operationId}}( void {{operationId}}(
{{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}, {{/allParams}}Callback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> cb {{#allParams}}{{>libraries/retrofit/queryParams}}{{>libraries/retrofit/pathParams}}{{>libraries/retrofit/headerParams}}{{>libraries/retrofit/bodyParams}}{{>libraries/retrofit/formParams}}, {{/allParams}}Callback<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> cb
); );

View File

@ -46,7 +46,7 @@ public interface {{classname}} {
{{/-first}} {{/-first}}
{{/prioritizedContentTypes}} {{/prioritizedContentTypes}}
{{/formParams}} {{/formParams}}
@{{httpMethod}}("{{path}}") @{{httpMethod}}("{{{path}}}")
{{^usePlay24WS}}{{^doNotUseRx}}Observable{{/doNotUseRx}}{{#doNotUseRx}}Call{{/doNotUseRx}}{{/usePlay24WS}}{{#usePlay24WS}}F.Promise<Response{{/usePlay24WS}}<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>{{#usePlay24WS}}>{{/usePlay24WS}} {{operationId}}({{^allParams}});{{/allParams}} {{^usePlay24WS}}{{^doNotUseRx}}Observable{{/doNotUseRx}}{{#doNotUseRx}}Call{{/doNotUseRx}}{{/usePlay24WS}}{{#usePlay24WS}}F.Promise<Response{{/usePlay24WS}}<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>{{#usePlay24WS}}>{{/usePlay24WS}} {{operationId}}({{^allParams}});{{/allParams}}
{{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}
);{{/hasMore}}{{/allParams}} );{{/hasMore}}{{/allParams}}

View File

@ -38,7 +38,7 @@ goog.require('{{import}}');
/** @private {!string} */ /** @private {!string} */
this.basePath_ = $injector.has('{{classname}}BasePath') ? this.basePath_ = $injector.has('{{classname}}BasePath') ?
/** @type {!string} */ ($injector.get('{{classname}}BasePath')) : /** @type {!string} */ ($injector.get('{{classname}}BasePath')) :
'{{basePath}}'; '{{{basePath}}}';
/** @private {!Object<string, string>} */ /** @private {!Object<string, string>} */
this.defaultHeaders_ = $injector.has('{{classname}}DefaultHeaders') ? this.defaultHeaders_ = $injector.has('{{classname}}DefaultHeaders') ?
@ -64,7 +64,7 @@ goog.require('{{import}}');
*/ */
{{package}}.{{classname}}.prototype.{{nickname}} = function({{#allParams}}{{^required}}opt_{{/required}}{{paramName}}, {{/allParams}}opt_extraHttpRequestParams) { {{package}}.{{classname}}.prototype.{{nickname}} = function({{#allParams}}{{^required}}opt_{{/required}}{{paramName}}, {{/allParams}}opt_extraHttpRequestParams) {
/** @const {string} */ /** @const {string} */
var path = this.basePath_ + '{{path}}'{{#pathParams}} var path = this.basePath_ + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{^required}}opt_{{/required}}{{paramName}})){{/pathParams}}; .replace('{' + '{{baseName}}' + '}', String({{^required}}opt_{{/required}}{{paramName}})){{/pathParams}};
/** @type {!Object} */ /** @type {!Object} */

View File

@ -32,9 +32,9 @@
{{#emitJSDoc}} /** {{#emitJSDoc}} /**
* The base URL against which to resolve every API call's (relative) path. * The base URL against which to resolve every API call's (relative) path.
* @type {String} * @type {String}
* @default {{basePath}} * @default {{{basePath}}}
*/ */
{{/emitJSDoc}} this.basePath = '{{basePath}}'.replace(/\/+$/, ''); {{/emitJSDoc}} this.basePath = '{{{basePath}}}'.replace(/\/+$/, '');
{{#emitJSDoc}} /** {{#emitJSDoc}} /**
* The authentication methods to be included for all API calls. * The authentication methods to be included for all API calls.

View File

@ -79,7 +79,7 @@ export const {{classname}}FetchParamCreator = {
} }
{{/required}} {{/required}}
{{/allParams}} {{/allParams}}
const baseUrl = `{{path}}`{{#pathParams}} const baseUrl = `{{{path}}}`{{#pathParams}}
.replace(`{${"{{baseName}}"}}`, `${ params["{{paramName}}"] }`){{/pathParams}}; .replace(`{${"{{baseName}}"}}`, `${ params["{{paramName}}"] }`){{/pathParams}};
let urlObj = url.parse(baseUrl, true); let urlObj = url.parse(baseUrl, true);
{{#hasQueryParams}} {{#hasQueryParams}}

View File

@ -20,7 +20,7 @@ object {{classname}} {
{{>javadoc}} {{>javadoc}}
{{/javadocRenderer}} {{/javadocRenderer}}
def {{operationId}}({{>methodParameters}}): ApiRequest[{{>operationReturnType}}] = def {{operationId}}({{>methodParameters}}): ApiRequest[{{>operationReturnType}}] =
ApiRequest[{{>operationReturnType}}](ApiMethods.{{httpMethod.toUpperCase}}, "{{basePath}}", "{{path}}", {{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}}) ApiRequest[{{>operationReturnType}}](ApiMethods.{{httpMethod.toUpperCase}}, "{{{basePath}}}", "{{{path}}}", {{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}})
{{#authMethods}}{{#isApiKey}}.withApiKey(apiKey, "{{keyParamName}}", {{#isKeyInQuery}}QUERY{{/isKeyInQuery}}{{#isKeyInHeader}}HEADER{{/isKeyInHeader}}) {{#authMethods}}{{#isApiKey}}.withApiKey(apiKey, "{{keyParamName}}", {{#isKeyInQuery}}QUERY{{/isKeyInQuery}}{{#isKeyInHeader}}HEADER{{/isKeyInHeader}})
{{/isApiKey}}{{#isBasic}}.withCredentials(basicAuth) {{/isApiKey}}{{#isBasic}}.withCredentials(basicAuth)
{{/isBasic}}{{/authMethods}}{{#bodyParam}}.withBody({{paramName}}) {{/isBasic}}{{/authMethods}}{{#bodyParam}}.withBody({{paramName}})

View File

@ -20,7 +20,7 @@ import java.io.File;
{{#operations}} {{#operations}}
public class {{classname}} { public class {{classname}} {
String basePath = "{{basePath}}"; String basePath = "{{{basePath}}}";
ApiInvoker apiInvoker = ApiInvoker.getInstance(); ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) { public void addHeader(String key, String value) {
@ -56,7 +56,7 @@ public class {{classname}} {
{{/required}}{{/allParams}} {{/required}}{{/allParams}}
// create path and map variables // create path and map variables
String localVarPath = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}}; String localVarPath = "{{{path}}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
// query params // query params
List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarQueryParams = new ArrayList<Pair>();

View File

@ -27,7 +27,7 @@ import java.util.concurrent.TimeoutException;
{{#operations}} {{#operations}}
public class {{classname}} { public class {{classname}} {
String basePath = "{{basePath}}"; String basePath = "{{{basePath}}}";
ApiInvoker apiInvoker = ApiInvoker.getInstance(); ApiInvoker apiInvoker = ApiInvoker.getInstance();
public void addHeader(String key, String value) { public void addHeader(String key, String value) {
@ -66,7 +66,7 @@ public class {{classname}} {
{{/allParams}} {{/allParams}}
// create path and map variables // create path and map variables
String path = "{{path}}"{{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}}; String path = "{{{path}}}"{{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
// query params // query params
List<Pair> queryParams = new ArrayList<Pair>(); List<Pair> queryParams = new ArrayList<Pair>();
@ -156,7 +156,7 @@ public class {{classname}} {
{{/required}}{{/allParams}} {{/required}}{{/allParams}}
// create path and map variables // create path and map variables
String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}}; String path = "{{{path}}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
// query params // query params
List<Pair> queryParams = new ArrayList<Pair>(); List<Pair> queryParams = new ArrayList<Pair>();

View File

@ -14,7 +14,7 @@ class {{classname}}(client: TransportClient, config: SwaggerConfig) extends ApiC
{{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}}, {{/required}}{{#required}}{{paramName}}: {{dataType}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{#hasMore}},
{{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = { {{/hasMore}}{{/required}}{{/allParams}})(implicit reader: ClientResponseReader[{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}]{{#bodyParams}}, writer: RequestWriter[{{dataType}}]{{/bodyParams}}){{#returnType}}: Future[{{returnType}}]{{/returnType}}{{^returnType}}: Future[Unit]{{/returnType}} = {
// create path and map variables // create path and map variables
val path = (addFmt("{{path}}"){{#pathParams}} val path = (addFmt("{{{path}}}"){{#pathParams}}
replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString){{/pathParams}}) replaceAll ("\\{" + "{{baseName}}" + "\\}",{{paramName}}.toString){{/pathParams}})
// query params // query params

View File

@ -815,10 +815,10 @@ call_{{operationId}}() {
local query_parameter_names=({{#queryParams}}{{baseName}}{{#hasMore}} {{/hasMore}}{{/queryParams}}) local query_parameter_names=({{#queryParams}}{{baseName}}{{#hasMore}} {{/hasMore}}{{/queryParams}})
if [[ $force = false ]]; then if [[ $force = false ]]; then
validate_request_parameters "{{basePathWithoutHost}}{{path}}" path_parameter_names query_parameter_names validate_request_parameters "{{basePathWithoutHost}}{{{path}}}" path_parameter_names query_parameter_names
fi fi
local path=$(build_request_path "{{basePathWithoutHost}}{{path}}" path_parameter_names query_parameter_names) local path=$(build_request_path "{{basePathWithoutHost}}{{{path}}}" path_parameter_names query_parameter_names)
local method="{{httpMethod}}" local method="{{httpMethod}}"
local headers_curl=$(header_arguments_to_curl) local headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then if [[ -n $header_accept ]]; then

View File

@ -37,7 +37,7 @@ pplx::task<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/r
{{/isContainer}}{{/isPrimitiveType}}{{/required}}{{/allParams}} {{/isContainer}}{{/isPrimitiveType}}{{/required}}{{/allParams}}
std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() ); std::shared_ptr<ApiConfiguration> apiConfiguration( m_ApiClient->getConfiguration() );
utility::string_t path = U("{{path}}"); utility::string_t path = U("{{{path}}}");
{{#pathParams}}boost::replace_all(path, U("{") U("{{baseName}}") U("}"), ApiClient::parameterToString({{{paramName}}})); {{#pathParams}}boost::replace_all(path, U("{") U("{{baseName}}") U("}"), ApiClient::parameterToString({{{paramName}}}));
{{/pathParams}} {{/pathParams}}

View File

@ -25,7 +25,7 @@ class {{classname}} {
{{/allParams}} {{/allParams}}
// create path and map variables // create path and map variables
String path = "{{path}}".replaceAll("{format}","json"){{#pathParams}}.replaceAll("{" + "{{baseName}}" + "}", {{{paramName}}}.toString()){{/pathParams}}; String path = "{{{path}}}".replaceAll("{format}","json"){{#pathParams}}.replaceAll("{" + "{{baseName}}" + "}", {{{paramName}}}.toString()){{/pathParams}};
// query params // query params
List<QueryParam> queryParams = []; List<QueryParam> queryParams = [];

View File

@ -5,7 +5,7 @@ defmodule {{#modulized}}{{appName}}{{/modulized}}.Api.{{classname}} do
use Tesla use Tesla
plug Tesla.Middleware.BaseUrl, "{{basePath}}" plug Tesla.Middleware.BaseUrl, "{{{basePath}}}"
plug Tesla.Middleware.JSON plug Tesla.Middleware.JSON
{{#operations}} {{#operations}}
{{#operation}} {{#operation}}

View File

@ -36,7 +36,7 @@ public class {{classname}} extends SwaggerApi {
*/ */
public function {{nickname}} ({{#allParams}}{{paramName}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): String { public function {{nickname}} ({{#allParams}}{{paramName}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): String {
// create path and map variables // create path and map variables
var path: String = "{{path}}".replace(/{format}/g,"xml"){{#pathParams}}.replace("{" + "{{baseName}}" + "}", getApiInvoker().escapeString({{{paramName}}})){{/pathParams}}; var path: String = "{{{path}}}".replace(/{format}/g,"xml"){{#pathParams}}.replace("{" + "{{baseName}}" + "}", getApiInvoker().escapeString({{{paramName}}})){{/pathParams}};
// query params // query params
var queryParams: Dictionary = new Dictionary(); var queryParams: Dictionary = new Dictionary();

View File

@ -41,7 +41,7 @@ func (a {{{classname}}}) {{{nickname}}}({{#allParams}}{{paramName}} {{{dataType}
var localVarHttpMethod = strings.ToUpper("{{httpMethod}}") var localVarHttpMethod = strings.ToUpper("{{httpMethod}}")
// create path and map variables // create path and map variables
localVarPath := a.Configuration.BasePath + "{{path}}"{{#pathParams}} localVarPath := a.Configuration.BasePath + "{{{path}}}"{{#pathParams}}
localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}} localVarPath = strings.Replace(localVarPath, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
localVarHeaderParams := make(map[string]string) localVarHeaderParams := make(map[string]string)

View File

@ -28,7 +28,7 @@
- (instancetype) init { - (instancetype) init {
self = [super init]; self = [super init];
if (self) { if (self) {
_host = @"{{basePath}}"; _host = @"{{{basePath}}}";
_username = @""; _username = @"";
_password = @""; _password = @"";
_accessToken= @""; _accessToken= @"";

View File

@ -77,7 +77,7 @@ NSInteger k{{classname}}MissingParamErrorCode = 234513;
{{/required}} {{/required}}
{{/allParams}} {{/allParams}}
NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"{{path}}"]; NSMutableString* resourcePath = [NSMutableString stringWithFormat:@"{{{path}}}"];
NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init]; NSMutableDictionary *pathParams = [[NSMutableDictionary alloc] init];
{{#pathParams}} {{#pathParams}}

View File

@ -33,7 +33,7 @@ sub _new_instance
my $class = shift; my $class = shift;
my (%args) = ( my (%args) = (
'ua' => LWP::UserAgent->new, 'ua' => LWP::UserAgent->new,
'base_url' => '{{basePath}}', 'base_url' => '{{{basePath}}}',
@_ @_
); );

View File

@ -78,7 +78,7 @@ sub {{operationId}} {
{{/required}} {{/required}}
{{/allParams}} {{/allParams}}
# parse inputs # parse inputs
my $_resource_path = '{{path}}'; my $_resource_path = '{{{path}}}';
my $_method = '{{httpMethod}}'; my $_method = '{{httpMethod}}';
my $query_params = {}; my $query_params = {};

View File

@ -163,7 +163,7 @@ use \{{invokerPackage}}\ObjectSerializer;
{{/hasValidation}} {{/hasValidation}}
{{/allParams}} {{/allParams}}
// parse inputs // parse inputs
$resourcePath = "{{path}}"; $resourcePath = "{{{path}}}";
$httpBody = ''; $httpBody = '';
$queryParams = []; $queryParams = [];
$headerParams = []; $headerParams = [];
@ -276,7 +276,7 @@ use \{{invokerPackage}}\ObjectSerializer;
{{^returnType}} {{^returnType}}
null, null,
{{/returnType}} {{/returnType}}
'{{path}}' '{{{path}}}'
); );
{{#returnType}} {{#returnType}}

View File

@ -78,7 +78,7 @@ class Configuration
* *
* @var string * @var string
*/ */
protected $host = '{{basePath}}'; protected $host = '{{{basePath}}}';
/** /**
* Timeout (second) of the HTTP request, by default set to 0, no timeout * Timeout (second) of the HTTP request, by default set to 0, no timeout

View File

@ -210,7 +210,7 @@ class {{classname}}(object):
# Authentication setting # Authentication setting
auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
return self.api_client.call_api('{{path}}', '{{httpMethod}}', return self.api_client.call_api('{{{path}}}', '{{httpMethod}}',
path_params, path_params,
query_params, query_params,
header_params, header_params,

View File

@ -36,7 +36,7 @@ class Configuration(object):
Constructor Constructor
""" """
# Default Base url # Default Base url
self.host = "{{basePath}}" self.host = "{{{basePath}}}"
# Default api client # Default api client
self.api_client = None self.api_client = None
# Temp file folder for downloading files # Temp file folder for downloading files

View File

@ -21,7 +21,7 @@ namespace Swagger {
void void
{{classname}}::{{nickname}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{classname}}::{{nickname}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
QString fullPath; QString fullPath;
fullPath.append(this->host).append(this->basePath).append("{{path}}"); fullPath.append(this->host).append(this->basePath).append("{{{path}}}");
{{#pathParams}} {{#pathParams}}
QString {{paramName}}PathParam("{"); {{paramName}}PathParam.append("{{baseName}}").append("}"); QString {{paramName}}PathParam("{"); {{paramName}}PathParam.append("{{baseName}}").append("}");

View File

@ -17,7 +17,7 @@ import java.util.Date
import scala.collection.mutable.HashMap import scala.collection.mutable.HashMap
{{#operations}} {{#operations}}
class {{classname}}(val defBasePath: String = "{{basePath}}", class {{classname}}(val defBasePath: String = "{{{basePath}}}",
defApiInvoker: ApiInvoker = ApiInvoker) { defApiInvoker: ApiInvoker = ApiInvoker) {
var basePath = defBasePath var basePath = defBasePath
var apiInvoker = defApiInvoker var apiInvoker = defApiInvoker
@ -33,7 +33,7 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
*/ */
def {{operationId}}({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Option[{{returnType}}]{{/returnType}} = { def {{operationId}}({{#allParams}}{{paramName}}: {{#required}}{{dataType}}{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{/required}}{{^required}}Option[{{dataType}}]{{#defaultValue}} /* = {{{defaultValue}}}*/{{/defaultValue}}{{^defaultValue}} = None{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}: Option[{{returnType}}]{{/returnType}} = {
// create path and map variables // create path and map variables
val path = "{{path}}".replaceAll("\\{format\\}", "json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}})){{/pathParams}} val path = "{{{path}}}".replaceAll("\\{format\\}", "json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}",apiInvoker.escape({{paramName}})){{/pathParams}}
val contentTypes = List({{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}"application/json"{{/consumes}}) val contentTypes = List({{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}"application/json"{{/consumes}})
val contentType = contentTypes(0) val contentType = contentTypes(0)

View File

@ -7,7 +7,7 @@
import Foundation import Foundation
public class {{projectName}}API { public class {{projectName}}API {
public static var basePath = "{{basePath}}" public static var basePath = "{{{basePath}}}"
public static var credential: NSURLCredential? public static var credential: NSURLCredential?
public static var customHeaders: [String:String] = [:] public static var customHeaders: [String:String] = [:]
static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()

View File

@ -90,7 +90,7 @@ public class {{classname}}: APIBase {
{{#summary}} {{#summary}}
{{{summary}}} {{{summary}}}
{{/summary}} {{/summary}}
- {{httpMethod}} {{path}}{{#notes}} - {{httpMethod}} {{{path}}}{{#notes}}
- {{{notes}}}{{/notes}}{{#subresourceOperation}} - {{{notes}}}{{/notes}}{{#subresourceOperation}}
- subresourceOperation: {{subresourceOperation}}{{/subresourceOperation}}{{#defaultResponse}} - subresourceOperation: {{subresourceOperation}}{{/subresourceOperation}}{{#defaultResponse}}
- defaultResponse: {{defaultResponse}}{{/defaultResponse}}{{#authMethods}} - defaultResponse: {{defaultResponse}}{{/defaultResponse}}{{#authMethods}}
@ -106,7 +106,7 @@ public class {{classname}}: APIBase {
- returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}} - returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}}
*/ */
public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
{{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{path}}"{{#pathParams}} {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{{path}}}"{{#pathParams}}
path = path.stringByReplacingOccurrencesOfString("{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", withString: "\({{paramName}}{{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}})", options: .LiteralSearch, range: nil){{/pathParams}} path = path.stringByReplacingOccurrencesOfString("{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", withString: "\({{paramName}}{{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}})", options: .LiteralSearch, range: nil){{/pathParams}}
let URLString = {{projectName}}API.basePath + path let URLString = {{projectName}}API.basePath + path
{{#bodyParam}} {{#bodyParam}}

View File

@ -7,7 +7,7 @@
import Foundation import Foundation
open class {{projectName}}API { open class {{projectName}}API {
open static var basePath = "{{basePath}}" open static var basePath = "{{{basePath}}}"
open static var credential: URLCredential? open static var credential: URLCredential?
open static var customHeaders: [String:String] = [:] open static var customHeaders: [String:String] = [:]
static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()

View File

@ -88,7 +88,7 @@ open class {{classname}}: APIBase {
{{#summary}} {{#summary}}
{{{summary}}} {{{summary}}}
{{/summary}} {{/summary}}
- {{httpMethod}} {{path}}{{#notes}} - {{httpMethod}} {{{path}}}{{#notes}}
- {{{notes}}}{{/notes}}{{#subresourceOperation}} - {{{notes}}}{{/notes}}{{#subresourceOperation}}
- subresourceOperation: {{subresourceOperation}}{{/subresourceOperation}}{{#defaultResponse}} - subresourceOperation: {{subresourceOperation}}{{/subresourceOperation}}{{#defaultResponse}}
- defaultResponse: {{defaultResponse}}{{/defaultResponse}}{{#authMethods}} - defaultResponse: {{defaultResponse}}{{/defaultResponse}}{{#authMethods}}
@ -104,7 +104,7 @@ open class {{classname}}: APIBase {
- returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}} - returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}}
*/ */
open class func {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { open class func {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}_{{operationId}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
{{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{path}}"{{#pathParams}} {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{{path}}}"{{#pathParams}}
path = path.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: "\({{paramName}}{{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}})", options: .literal, range: nil){{/pathParams}} path = path.replacingOccurrences(of: "{{=<% %>=}}{<%baseName%>}<%={{ }}=%>", with: "\({{paramName}}{{#isEnum}}{{#isContainer}}{{{dataType}}}{{/isContainer}}{{^isContainer}}.rawValue{{/isContainer}}{{/isEnum}})", options: .literal, range: nil){{/pathParams}}
let URLString = {{projectName}}API.basePath + path let URLString = {{projectName}}API.basePath + path
{{#bodyParam}} {{#bodyParam}}

View File

@ -23,7 +23,7 @@ public:
{{nickname}}WithCompletion({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}},{{/hasParams}} {{#returnType}}void (* handler)({{returnType}}, {{prefix}}Error*){{/returnType}}{{^returnType}}void(* handler)({{prefix}}Error*){{/returnType}}); {{nickname}}WithCompletion({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}},{{/hasParams}} {{#returnType}}void (* handler)({{returnType}}, {{prefix}}Error*){{/returnType}}{{^returnType}}void(* handler)({{prefix}}Error*){{/returnType}});
{{/operation}} {{/operation}}
static String getBasePath() { static String getBasePath() {
return L"{{basePath}}"; return L"{{{basePath}}}";
} }
private: private:

View File

@ -10,7 +10,7 @@ import * as models from '../model/models';
*/ */
{{/description}} {{/description}}
export class {{classname}} { export class {{classname}} {
protected basePath = '{{basePath}}'; protected basePath = '{{{basePath}}}';
public defaultHeaders : any = {}; public defaultHeaders : any = {};
static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath']; static $inject: string[] = ['$http', '$httpParamSerializer', 'basePath'];
@ -28,7 +28,7 @@ export class {{classname}} {
{{#allParams}}* @param {{paramName}} {{description}} {{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/ {{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> { public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any ) : ng.IHttpPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}> {
const localVarPath = this.basePath + '{{path}}'{{#pathParams}} const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
let queryParameters: any = {}; let queryParameters: any = {};
@ -82,4 +82,4 @@ export class {{classname}} {
} }
{{/operation}} {{/operation}}
} }
{{/operations}} {{/operations}}

View File

@ -61,7 +61,7 @@ export class {{classname}} {
{{#allParams}}* @param {{paramName}} {{description}} {{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/ {{/allParams}}*/
public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<Response> { public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: any): Observable<Response> {
const path = this.basePath + '{{path}}'{{#pathParams}} const path = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('${' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; .replace('${' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
let queryParameters = new URLSearchParams(); let queryParameters = new URLSearchParams();

View File

@ -1,6 +1,6 @@
import * as $ from 'jquery'; import * as $ from 'jquery';
let defaultBasePath = '{{basePath}}'; let defaultBasePath = '{{{basePath}}}';
// =============================================== // ===============================================
// This file is autogenerated - Please do not edit // This file is autogenerated - Please do not edit
@ -183,7 +183,7 @@ export class {{classname}} {
{{#allParams}}* @param {{paramName}} {{description}} {{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/ {{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : JQueryPromise<{ response: JQueryXHR; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
let localVarPath = this.basePath + '{{path}}'{{#pathParams}} let localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
let queryParameters: any = {}; let queryParameters: any = {};
let headerParams: any = this.extendObj({}, this.defaultHeaders); let headerParams: any = this.extendObj({}, this.defaultHeaders);

View File

@ -5,7 +5,7 @@ import http = require('http');
import Promise = require('bluebird'); import Promise = require('bluebird');
{{/supportsES6}} {{/supportsES6}}
let defaultBasePath = '{{basePath}}'; let defaultBasePath = '{{{basePath}}}';
// =============================================== // ===============================================
// This file is autogenerated - Please do not edit // This file is autogenerated - Please do not edit
@ -190,7 +190,7 @@ export class {{classname}} {
{{#allParams}}* @param {{paramName}} {{description}} {{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/ {{/allParams}}*/
public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> { public {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) : Promise<{ response: http.{{#supportsES6}}IncomingMessage{{/supportsES6}}{{^supportsES6}}ClientResponse{{/supportsES6}}; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
const localVarPath = this.basePath + '{{path}}'{{#pathParams}} const localVarPath = this.basePath + '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}}; .replace('{' + '{{baseName}}' + '}', String({{paramName}})){{/pathParams}};
let queryParameters: any = {}; let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders); let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);