Add "decimal" support (#7808)

* rename BigDecimal to decimal

* add isDecimal

* fix tests

* minor fixes

* fix mapping, update doc

* update test spec

* update c# samples
This commit is contained in:
William Cheng
2020-11-02 21:31:32 +08:00
committed by GitHub
parent ca6fcaf92a
commit 9377dbca56
68 changed files with 391 additions and 65 deletions

View File

@@ -66,6 +66,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
'number' => 'float',
'float' => 'float',
'double' => 'double',
'decimal' => 'Decimal',
'string' => 'string',
'byte' => 'string',
'binary' => '\SplFileObject',
@@ -91,6 +92,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
'number' => null,
'float' => 'float',
'double' => 'double',
'decimal' => 'number',
'string' => null,
'byte' => 'byte',
'binary' => 'binary',
@@ -135,6 +137,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
'number' => 'number',
'float' => 'float',
'double' => 'double',
'decimal' => 'decimal',
'string' => 'string',
'byte' => 'byte',
'binary' => 'binary',
@@ -158,6 +161,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
'number' => 'setNumber',
'float' => 'setFloat',
'double' => 'setDouble',
'decimal' => 'setDecimal',
'string' => 'setString',
'byte' => 'setByte',
'binary' => 'setBinary',
@@ -181,6 +185,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
'number' => 'getNumber',
'float' => 'getFloat',
'double' => 'getDouble',
'decimal' => 'getDecimal',
'string' => 'getString',
'byte' => 'getByte',
'binary' => 'getBinary',
@@ -258,6 +263,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
$this->container['number'] = $data['number'] ?? null;
$this->container['float'] = $data['float'] ?? null;
$this->container['double'] = $data['double'] ?? null;
$this->container['decimal'] = $data['decimal'] ?? null;
$this->container['string'] = $data['string'] ?? null;
$this->container['byte'] = $data['byte'] ?? null;
$this->container['binary'] = $data['binary'] ?? null;
@@ -549,6 +555,30 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
return $this;
}
/**
* Gets decimal
*
* @return Decimal|null
*/
public function getDecimal()
{
return $this->container['decimal'];
}
/**
* Sets decimal
*
* @param Decimal|null $decimal decimal
*
* @return self
*/
public function setDecimal($decimal)
{
$this->container['decimal'] = $decimal;
return $this;
}
/**
* Gets string
*