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())) {
datatype = SchemaTypeUtil.DOUBLE_FORMAT;
} else { // without format
datatype = "BigDecimal";
datatype = schema.getType(); // number
}
} else if (schema instanceof IntegerSchema || SchemaTypeUtil.INTEGER_TYPE.equals(schema.getType())) {
if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) {
@ -4155,6 +4155,7 @@ public class DefaultCodegen implements CodegenConfig {
codegenProperty = codegenProperty.items;
}
} else {
// TODO need to handle primitive type in this block
LOGGER.warn("Scheme type " + schema.getType() + " not handled in reqeust body");
}

View File

@ -3,6 +3,6 @@
## Properties
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
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]
**int32** | **Integer** | | [optional]
**int64** | **Integer** | | [optional]
**number** | [**BigDecimal**](BigDecimal.md) | |
**number** | **Float** | |
**float** | **Float** | | [optional]
**double** | **Float** | | [optional]
**string** | **String** | | [optional]

View File

@ -3,6 +3,6 @@
## Properties
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.
def self.swagger_types
{
:'array_array_number' => :'Array<Array<BigDecimal>>'
:'array_array_number' => :'Array<Array<Float>>'
}
end

View File

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

View File

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

View File

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