forked from loafle/openapi-generator-original
Merge branch 'develop_2.0' of github.com:swagger-api/swagger-codegen into develop_2.0
This commit is contained in:
@@ -16,7 +16,7 @@ Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additi
|
||||
## Compatability
|
||||
The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification:
|
||||
|
||||
Swagger Codegen Version | Release Date | Swagger Spec compatability | Notes
|
||||
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
|
||||
----------------------- | ------------ | -------------------------- | -----
|
||||
2.1.3-M1-SNAPSHOT | 2015-02-23 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.0-M1](https://github.com/swagger-api/swagger-codegen)
|
||||
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
|
||||
|
||||
@@ -556,14 +556,18 @@ public class DefaultCodegen {
|
||||
property.isPrimitiveType = true;
|
||||
}
|
||||
else {
|
||||
property.isNotContainer = true;
|
||||
setNonArrayMapProperty(property, type);
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||
property.isNotContainer = true;
|
||||
if(languageSpecificPrimitives().contains(type))
|
||||
property.isPrimitiveType = true;
|
||||
else
|
||||
property.complexType = property.baseType;
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
private Response findMethodResponse(Map<String, Response> responses) {
|
||||
|
||||
|
||||
@@ -168,7 +168,18 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||
super.setNonArrayMapProperty(property, type);
|
||||
if("NSDictionary".equals(type)) {
|
||||
property.setter = "initWithDictionary";
|
||||
}
|
||||
else {
|
||||
property.setter = "initWithValues";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelImport(String name) {
|
||||
if("".equals(modelPackage()))
|
||||
return name;
|
||||
|
||||
@@ -165,12 +165,12 @@ public class ApiInvoker {
|
||||
|
||||
Builder builder = client.resource(host + path + querystring).accept("application/json");
|
||||
for(String key : headerParams.keySet()) {
|
||||
builder.header(key, headerParams.get(key));
|
||||
builder = builder.header(key, headerParams.get(key));
|
||||
}
|
||||
|
||||
for(String key : defaultHeaderMap.keySet()) {
|
||||
if(!headerParams.containsKey(key)) {
|
||||
builder.header(key, defaultHeaderMap.get(key));
|
||||
builder = builder.header(key, defaultHeaderMap.get(key));
|
||||
}
|
||||
}
|
||||
ClientResponse response = null;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
{{/isContainer}}{{#isNotContainer}}
|
||||
if({{name}}_dict != nil)
|
||||
_{{name}} = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{complexType}}} {{/instantiationType}} alloc]initWithValues:{{name}}_dict];
|
||||
_{{name}} = [[{{#instantiationType}}NSClassFromString(@"{{{instantiationType}}}") {{/instantiationType}}{{^instantiationType}}{{{complexType}}} {{/instantiationType}} alloc]{{setter}}:{{name}}_dict];
|
||||
{{/isNotContainer}}
|
||||
{{/complexType}}
|
||||
{{/vars}}{{newline}}
|
||||
|
||||
@@ -182,7 +182,7 @@ class APIClient {
|
||||
} else if (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||
$values[$property] = $this->sanitizeForSerialization($data->$property);
|
||||
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
|
||||
}
|
||||
$sanitized = $values;
|
||||
} else {
|
||||
@@ -295,7 +295,8 @@ class APIClient {
|
||||
$instance = new $class();
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
if (isset($data->$property)) {
|
||||
$instance->$property = self::deserialize($data->$property, $type);
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
|
||||
@@ -28,7 +28,12 @@ class {{classname}} implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
);
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
||||
{{/hasMore}}{{/vars}}
|
||||
);
|
||||
|
||||
{{#vars}}{{#description}}
|
||||
/**
|
||||
|
||||
@@ -226,7 +226,7 @@ class ApiClient:
|
||||
subValues.append(self.deserialize(subValue, subClass))
|
||||
setattr(instance, attr, subValues)
|
||||
else:
|
||||
setattr(instance, attr, self.deserialize(value, objClass))
|
||||
setattr(instance, attr, self.deserialize(value, attrType))
|
||||
|
||||
return instance
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ module Swagger
|
||||
class Configuration
|
||||
require 'swagger/version'
|
||||
|
||||
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params
|
||||
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params, :user_agent
|
||||
|
||||
# Defaults go in here..
|
||||
def initialize
|
||||
@@ -11,7 +11,7 @@ module Swagger
|
||||
@scheme = 'http'
|
||||
@host = 'api.wordnik.com'
|
||||
@base_path = '/v4'
|
||||
@user_agent = "ruby-#{Swagger::VERSION}"
|
||||
@user_agent = "ruby-swagger-#{Swagger::VERSION}"
|
||||
@inject_format = true
|
||||
@force_ending_format = false
|
||||
@camelize_params = true
|
||||
@@ -19,4 +19,4 @@ module Swagger
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,8 @@ module Swagger
|
||||
# Set default headers
|
||||
default_headers = {
|
||||
'Content-Type' => "application/#{attributes[:format].downcase}",
|
||||
:api_key => Swagger.configuration.api_key
|
||||
:api_key => Swagger.configuration.api_key,
|
||||
'User-Agent' => Swagger.configuration.user_agent
|
||||
}
|
||||
|
||||
# api_key from headers hash trumps the default, even if its value is blank
|
||||
|
||||
@@ -182,7 +182,7 @@ class APIClient {
|
||||
} else if (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||
$values[$property] = $this->sanitizeForSerialization($data->$property);
|
||||
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
|
||||
}
|
||||
$sanitized = $values;
|
||||
} else {
|
||||
@@ -295,7 +295,8 @@ class APIClient {
|
||||
$instance = new $class();
|
||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||
if (isset($data->$property)) {
|
||||
$instance->$property = self::deserialize($data->$property, $type);
|
||||
$original_property_name = $instance::$attributeMap[$property];
|
||||
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
|
||||
@@ -26,7 +26,12 @@ class Category implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
);
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
|
||||
@@ -30,7 +30,16 @@ class Order implements ArrayAccess {
|
||||
'shipDate' => 'DateTime',
|
||||
'status' => 'string',
|
||||
'complete' => 'boolean'
|
||||
);
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'petId' => 'petId',
|
||||
'quantity' => 'quantity',
|
||||
'shipDate' => 'shipDate',
|
||||
'status' => 'status',
|
||||
'complete' => 'complete'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
|
||||
@@ -30,7 +30,16 @@ class Pet implements ArrayAccess {
|
||||
'photoUrls' => 'array[string]',
|
||||
'tags' => 'array[Tag]',
|
||||
'status' => 'string'
|
||||
);
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'category' => 'category',
|
||||
'name' => 'name',
|
||||
'photoUrls' => 'photoUrls',
|
||||
'tags' => 'tags',
|
||||
'status' => 'status'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
|
||||
@@ -26,7 +26,12 @@ class Tag implements ArrayAccess {
|
||||
static $swaggerTypes = array(
|
||||
'id' => 'int',
|
||||
'name' => 'string'
|
||||
);
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
|
||||
@@ -32,7 +32,18 @@ class User implements ArrayAccess {
|
||||
'password' => 'string',
|
||||
'phone' => 'string',
|
||||
'userStatus' => 'int'
|
||||
);
|
||||
);
|
||||
|
||||
static $attributeMap = array(
|
||||
'id' => 'id',
|
||||
'username' => 'username',
|
||||
'firstName' => 'firstName',
|
||||
'lastName' => 'lastName',
|
||||
'email' => 'email',
|
||||
'password' => 'password',
|
||||
'phone' => 'phone',
|
||||
'userStatus' => 'userStatus'
|
||||
);
|
||||
|
||||
|
||||
public $id; /* int */
|
||||
|
||||
@@ -16,7 +16,7 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:body => body
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -77,7 +77,7 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:body => body
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -138,7 +138,7 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:status => status
|
||||
:'status' => status
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -180,7 +180,7 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:tags => tags
|
||||
:'tags' => tags
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -222,7 +222,7 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:petId => petId
|
||||
:'petId' => petId
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -264,9 +264,9 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:petId => petId,
|
||||
:name => name,
|
||||
:status => status
|
||||
:'petId' => petId,
|
||||
:'name' => name,
|
||||
:'status' => status
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -309,8 +309,8 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:api_key => api_key,
|
||||
:petId => petId
|
||||
:'api_key' => api_key,
|
||||
:'petId' => petId
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -351,9 +351,9 @@ class PetApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:petId => petId,
|
||||
:additionalMetadata => additionalMetadata,
|
||||
:file => file
|
||||
:'petId' => petId,
|
||||
:'additionalMetadata' => additionalMetadata,
|
||||
:'file' => file
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class StoreApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:body => body
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -119,7 +119,7 @@ class StoreApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:orderId => orderId
|
||||
:'orderId' => orderId
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -161,7 +161,7 @@ class StoreApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:orderId => orderId
|
||||
:'orderId' => orderId
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:body => body
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -77,7 +77,7 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:body => body
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -138,7 +138,7 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:body => body
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -199,8 +199,8 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:username => username,
|
||||
:password => password
|
||||
:'username' => username,
|
||||
:'password' => password
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -280,7 +280,7 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:username => username
|
||||
:'username' => username
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -322,8 +322,8 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:username => username,
|
||||
:body => body
|
||||
:'username' => username,
|
||||
:'body' => body
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
@@ -385,7 +385,7 @@ class UserApi
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
:username => username
|
||||
:'username' => username
|
||||
|
||||
}.merge(opts)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ module Swagger
|
||||
class Configuration
|
||||
require 'swagger/version'
|
||||
|
||||
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params
|
||||
attr_accessor :format, :api_key, :username, :password, :auth_token, :scheme, :host, :base_path, :user_agent, :logger, :inject_format, :force_ending_format, :camelize_params, :user_agent
|
||||
|
||||
# Defaults go in here..
|
||||
def initialize
|
||||
@@ -11,7 +11,7 @@ module Swagger
|
||||
@scheme = 'http'
|
||||
@host = 'api.wordnik.com'
|
||||
@base_path = '/v4'
|
||||
@user_agent = "ruby-#{Swagger::VERSION}"
|
||||
@user_agent = "ruby-swagger-#{Swagger::VERSION}"
|
||||
@inject_format = true
|
||||
@force_ending_format = false
|
||||
@camelize_params = true
|
||||
@@ -19,4 +19,4 @@ module Swagger
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,7 +19,8 @@ module Swagger
|
||||
# Set default headers
|
||||
default_headers = {
|
||||
'Content-Type' => "application/#{attributes[:format].downcase}",
|
||||
:api_key => Swagger.configuration.api_key
|
||||
:api_key => Swagger.configuration.api_key,
|
||||
'User-Agent' => Swagger.configuration.user_agent
|
||||
}
|
||||
|
||||
# api_key from headers hash trumps the default, even if its value is blank
|
||||
|
||||
Reference in New Issue
Block a user