Merge remote-tracking branch 'origin/master' into 2.3.0

This commit is contained in:
wing328
2016-10-14 17:01:05 +08:00
23 changed files with 100 additions and 30 deletions

View File

@@ -92,4 +92,16 @@ public class ConfluenceWikiGenerator extends DefaultCodegen implements CodegenCo
}
return objs;
}
@Override
public String escapeQuotationMark(String input) {
// just return the original string
return input;
}
@Override
public String escapeUnsafeCharacters(String input) {
// just return the original string
return input;
}
}

View File

@@ -16,6 +16,8 @@ import org.apache.http.params.*;
import org.apache.http.util.EntityUtils;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.net.URLEncoder;
@@ -25,8 +27,6 @@ import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.KeyManagementException;
@@ -207,7 +207,11 @@ public class ApiInvoker {
}
public String escapeString(String str) {
return str;
try {
return URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
return str;
}
}
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {

View File

@@ -20,6 +20,7 @@ import org.apache.http.HttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -232,7 +233,11 @@ public class ApiInvoker {
}
public String escapeString(String str) {
return str;
try {
return URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException e) {
return str;
}
}
public static Object deserialize(String json, String containerType, Class cls) throws ApiException {

View File

@@ -32,12 +32,12 @@ h2. Endpoints
{{/bodyParams}}
{{/hasBodyParam}}
{{#hasHeaderParam}}
{{#hasHeaderParams}}
h5. Header Parameters
||Name||Description||Required||Default||Pattern||
{{#headerParam}}{{>param}}
{{/headerParam}}
{{/hasHeaderParam}}
{{/hasHeaderParams}}
{{#hasQueryParams}}
h5. Query Parameters
@@ -91,4 +91,4 @@ h2. Models
{{#vars}} |{{name}} |{{#isNotRequired}}(x){{/isNotRequired}} |{{datatype}} |{{description}} |
{{/vars}}
{{/model}}
{{/models}}
{{/models}}

View File

@@ -80,12 +80,12 @@
</div> <!-- field-items -->
{{/hasBodyParam}}
{{#hasHeaderParam}}
{{#hasHeaderParams}}
<h3 class="field-label">Request headers</h3>
<div class="field-items">
{{#headerParam}}{{>headerParam}}{{/headerParam}}
</div> <!-- field-items -->
{{/hasHeaderParam}}
{{/hasHeaderParams}}
{{#hasQueryParams}}
<h3 class="field-label">Query parameters</h3>

View File

@@ -266,7 +266,7 @@ function loadGoogleFontCss() {
<div class="tab-content">
<div class="tab-pane active" id="examples-{{baseName}}-{{nickname}}-0-curl">
<pre class="prettyprint"><code class="language-bsh">
curl -X <span style="text-transform: uppercase;">{{httpMethod}}</span>{{#isApiKey}} -H "apiKey: [[apiKey]]" -H "apiSecret: [[apiSecret]]"{{/isApiKey}} "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{paramName}}={{vendorExtensions.x-eg}}{{/queryParams}}{{/hasQueryParams}}"
curl -X <span style="text-transform: uppercase;">{{httpMethod}}</span>{{#authMethods}}{{#isApiKey}}{{#isKeyInHeader}} -H "{{keyParamName}}: [[apiKey]]" {{/isKeyInHeader}}{{/isApiKey}}{{#isBasic}} -H "Authorization: Basic [[basicHash]]" {{/isBasic}}{{/authMethods}} "{{basePath}}{{path}}{{#hasQueryParams}}?{{#queryParams}}{{^-first}}&{{/-first}}{{paramName}}={{vendorExtensions.x-eg}}{{/queryParams}}{{/hasQueryParams}}"
</code></pre>

View File

@@ -70,7 +70,7 @@ from pprint import pprint
{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
# create an instance of the API class
api_instance = {{{packageName}}}.{{{classname}}}
api_instance = {{{packageName}}}.{{{classname}}}()
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}

View File

@@ -176,7 +176,7 @@ class ApiClient(object):
:param obj: The data to serialize.
:return: The serialized form of data.
"""
types = (str, float, bool, tuple) + tuple(integer_types) + (text_type,)
types = (str, float, bool, bytes) + tuple(integer_types) + (text_type,)
if isinstance(obj, type(None)):
return None
elif isinstance(obj, types):
@@ -184,6 +184,9 @@ class ApiClient(object):
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime, date)):
return obj.isoformat()
else:

View File

@@ -78,13 +78,13 @@
def list_invalid_properties
invalid_properties = Array.new
{{#vars}}
{{#hasValidation}}
{{#required}}
if @{{{name}}}.nil?
invalid_properties.push("invalid value for '{{{name}}}', {{{name}}} cannot be nil.")
end
{{/required}}
{{/required}}
{{#hasValidation}}
{{#maxLength}}
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
invalid_properties.push("invalid value for '{{{name}}}', the character length must be smaller than or equal to {{{maxLength}}}.")