fix bigdecimal in default codegen

This commit is contained in:
wing328 2018-04-09 01:14:51 +08:00
parent ffa0e115d9
commit 9d1ae0dd29
9 changed files with 11 additions and 10 deletions

View File

@ -1139,7 +1139,7 @@ public class DefaultCodegen implements CodegenConfig {
} else if (SchemaTypeUtil.DOUBLE_FORMAT.equals(schema.getFormat())) { } else if (SchemaTypeUtil.DOUBLE_FORMAT.equals(schema.getFormat())) {
datatype = SchemaTypeUtil.DOUBLE_FORMAT; datatype = SchemaTypeUtil.DOUBLE_FORMAT;
} else { // without format } else { // without format
datatype = "BigDecimal"; datatype = schema.getType(); // number
} }
} else if (schema instanceof IntegerSchema || SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType())) { } else if (schema instanceof IntegerSchema || SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType())) {
if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) { if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) {
@ -4155,7 +4155,8 @@ public class DefaultCodegen implements CodegenConfig {
codegenProperty = codegenProperty.items; codegenProperty = codegenProperty.items;
} }
} else { } else {
LOGGER.warn("Scheme type " + schema.getType() + "not handled in reqeust body"); // TODO need to handle primitive type in this block
LOGGER.warn("Scheme type " + schema.getType() + " not handled in reqeust body");
} }
// set the parameter's example value // set the parameter's example value

View File

@ -3,6 +3,6 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**array_array_number** | **Array<Array<BigDecimal>>** | | [optional] **array_array_number** | **Array<Array<Float>>** | | [optional]

View File

@ -3,6 +3,6 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**array_number** | [**Array<BigDecimal>**](BigDecimal.md) | | [optional] **array_number** | **Array<Float>** | | [optional]

View File

@ -6,7 +6,7 @@ Name | Type | Description | Notes
**integer** | **Integer** | | [optional] **integer** | **Integer** | | [optional]
**int32** | **Integer** | | [optional] **int32** | **Integer** | | [optional]
**int64** | **Integer** | | [optional] **int64** | **Integer** | | [optional]
**number** | [**BigDecimal**](BigDecimal.md) | | **number** | **Float** | |
**float** | **Float** | | [optional] **float** | **Float** | | [optional]
**double** | **Float** | | [optional] **double** | **Float** | | [optional]
**string** | **String** | | [optional] **string** | **String** | | [optional]

View File

@ -3,6 +3,6 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**just_number** | [**BigDecimal**](BigDecimal.md) | | [optional] **just_number** | **Float** | | [optional]

View File

@ -26,7 +26,7 @@ module Petstore
# Attribute type mapping. # Attribute type mapping.
def self.swagger_types def self.swagger_types
{ {
:'array_array_number' => :'Array<Array<BigDecimal>>' :'array_array_number' => :'Array<Array<Float>>'
} }
end end

View File

@ -26,7 +26,7 @@ module Petstore
# Attribute type mapping. # Attribute type mapping.
def self.swagger_types def self.swagger_types
{ {
:'array_number' => :'Array<BigDecimal>' :'array_number' => :'Array<Float>'
} }
end end

View File

@ -65,7 +65,7 @@ module Petstore
:'integer' => :'Integer', :'integer' => :'Integer',
:'int32' => :'Integer', :'int32' => :'Integer',
:'int64' => :'Integer', :'int64' => :'Integer',
:'number' => :'BigDecimal', :'number' => :'Float',
:'float' => :'Float', :'float' => :'Float',
:'double' => :'Float', :'double' => :'Float',
:'string' => :'String', :'string' => :'String',

View File

@ -26,7 +26,7 @@ module Petstore
# Attribute type mapping. # Attribute type mapping.
def self.swagger_types def self.swagger_types
{ {
:'just_number' => :'BigDecimal' :'just_number' => :'Float'
} }
end end