Skip to content

Commit

Permalink
fix bigdecimal in default codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 committed Apr 8, 2018
1 parent ffa0e11 commit 9d1ae0d
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ public String getSchemaType(Schema schema) {
} 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())) {
Expand Down Expand Up @@ -4155,7 +4155,8 @@ public CodegenParameter fromRequestBody(RequestBody body, Map<String, Schema> sc
codegenProperty = codegenProperty.items;
}
} 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_array_number** | **Array&lt;Array&lt;BigDecimal&gt;&gt;** | | [optional]
**array_array_number** | **Array&lt;Array&lt;Float&gt;&gt;** | | [optional]


2 changes: 1 addition & 1 deletion samples/client/petstore/ruby/docs/ArrayOfNumberOnly.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_number** | [**Array&lt;BigDecimal&gt;**](BigDecimal.md) | | [optional]
**array_number** | **Array&lt;Float&gt;** | | [optional]


2 changes: 1 addition & 1 deletion samples/client/petstore/ruby/docs/FormatTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/ruby/docs/NumberOnly.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_number** | [**BigDecimal**](BigDecimal.md) | | [optional]
**just_number** | **Float** | | [optional]


Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def self.attribute_map
# Attribute type mapping.
def self.swagger_types
{
:'array_array_number' => :'Array<Array<BigDecimal>>'
:'array_array_number' => :'Array<Array<Float>>'
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def self.attribute_map
# Attribute type mapping.
def self.swagger_types
{
:'array_number' => :'Array<BigDecimal>'
:'array_number' => :'Array<Float>'
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def self.swagger_types
:'integer' => :'Integer',
:'int32' => :'Integer',
:'int64' => :'Integer',
:'number' => :'BigDecimal',
:'number' => :'Float',
:'float' => :'Float',
:'double' => :'Float',
:'string' => :'String',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def self.attribute_map
# Attribute type mapping.
def self.swagger_types
{
:'just_number' => :'BigDecimal'
:'just_number' => :'Float'
}
end

Expand Down

0 comments on commit 9d1ae0d

Please sign in to comment.