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

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

View File

@ -151,7 +151,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
```
(if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`)
You can also download the JAR (latest relesae) directly from [maven.org](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar )
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar )
To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate`
@ -783,6 +783,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [nViso](http://www.nviso.ch/)
- [Okiok](https://www.okiok.com)
- [Onedata](http://onedata.org)
- [OrderCloud.io](http://ordercloud.io)
- [OSDN](https://osdn.jp)
- [PagerDuty](https://www.pagerduty.com)
- [Pepipost](https://www.pepipost.com)

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

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}}}.")

View File

@ -39,6 +39,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;
@ -48,8 +50,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;
@ -230,7 +230,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

@ -43,6 +43,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;
@ -246,7 +247,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

@ -51,7 +51,7 @@ import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = petstore_api.FakeApi
api_instance = petstore_api.FakeApi()
body = petstore_api.Client() # Client | client model
try:

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

@ -71,6 +71,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @class_name.nil?
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
end
return invalid_properties
end

View File

@ -79,6 +79,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @class_name.nil?
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
end
return invalid_properties
end

View File

@ -79,6 +79,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @class_name.nil?
invalid_properties.push("invalid value for 'class_name', class_name cannot be nil.")
end
return invalid_properties
end

View File

@ -157,7 +157,6 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if !@integer.nil? && @integer > 100.0
invalid_properties.push("invalid value for 'integer', must be smaller than or equal to 100.0.")
end
@ -166,7 +165,6 @@ module Petstore
invalid_properties.push("invalid value for 'integer', must be greater than or equal to 10.0.")
end
if !@int32.nil? && @int32 > 200.0
invalid_properties.push("invalid value for 'int32', must be smaller than or equal to 200.0.")
end
@ -187,7 +185,6 @@ module Petstore
invalid_properties.push("invalid value for 'number', must be greater than or equal to 32.1.")
end
if !@float.nil? && @float > 987.6
invalid_properties.push("invalid value for 'float', must be smaller than or equal to 987.6.")
end
@ -196,7 +193,6 @@ module Petstore
invalid_properties.push("invalid value for 'float', must be greater than or equal to 54.3.")
end
if !@double.nil? && @double > 123.4
invalid_properties.push("invalid value for 'double', must be smaller than or equal to 123.4.")
end
@ -205,11 +201,18 @@ module Petstore
invalid_properties.push("invalid value for 'double', must be greater than or equal to 67.8.")
end
if !@string.nil? && @string !~ Regexp.new(/[a-z]/i)
invalid_properties.push("invalid value for 'string', must conform to the pattern /[a-z]/i.")
end
if @byte.nil?
invalid_properties.push("invalid value for 'byte', byte cannot be nil.")
end
if @date.nil?
invalid_properties.push("invalid value for 'date', date cannot be nil.")
end
if @password.nil?
invalid_properties.push("invalid value for 'password', password cannot be nil.")
end

View File

@ -85,6 +85,10 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @name.nil?
invalid_properties.push("invalid value for 'name', name cannot be nil.")
end
return invalid_properties
end

View File

@ -127,6 +127,14 @@ module Petstore
# @return Array for valid properies with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @name.nil?
invalid_properties.push("invalid value for 'name', name cannot be nil.")
end
if @photo_urls.nil?
invalid_properties.push("invalid value for 'photo_urls', photo_urls cannot be nil.")
end
return invalid_properties
end

View File

@ -60,6 +60,8 @@ h2. Endpoints
|petId |Pet id to delete |(/) | | |
h5. Header Parameters
||Name||Description||Required||Default||Pattern||

View File

@ -288,6 +288,10 @@ font-style: italic;
<h3 class="field-label">Request headers</h3>
<div class="field-items">
</div> <!-- field-items -->

View File

@ -2834,7 +2834,7 @@ try {
<div class="tab-content">
<div class="tab-pane active" id="examples-Pet-getPetById-0-curl">
<pre class="prettyprint"><code class="language-bsh">
curl -X <span style="text-transform: uppercase;">get</span> "http://petstore.swagger.io/v2/pet/{petId}"
curl -X <span style="text-transform: uppercase;">get</span> -H "api_key: [[apiKey]]" "http://petstore.swagger.io/v2/pet/{petId}"
</code></pre>
@ -5195,7 +5195,7 @@ try {
<div class="tab-content">
<div class="tab-pane active" id="examples-Store-getInventory-0-curl">
<pre class="prettyprint"><code class="language-bsh">
curl -X <span style="text-transform: uppercase;">get</span> "http://petstore.swagger.io/v2/store/inventory"
curl -X <span style="text-transform: uppercase;">get</span> -H "api_key: [[apiKey]]" "http://petstore.swagger.io/v2/store/inventory"
</code></pre>
@ -9921,7 +9921,7 @@ try {
</div>
<div id="generator">
<div class="content">
Generated 2016-09-29T11:08:44.942+08:00
Generated 2016-10-13T09:03:51.792-07:00
</div>
</div>
</div>