Skip to content

maximum, minimum are now stored as BigDecimal  #4478

@wing328

Description

@wing328
Description

maximum, minimum are now stored as BigDecimal

Ref: https://github.com/swagger-api/swagger-core/blob/72495dc1e7a458fd34b20c271b08a56f44d37849/modules/swagger-models/src/main/java/io/swagger/models/properties/AbstractNumericProperty.java

and the value in the mustuche template has changed accordingly. Here is an example showing the differences:

diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerC
lient-php/lib/Api/FakeApi.php
index 9d13660..465c520 100644
--- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
+++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
@@ -226,22 +226,22 @@ class FakeApi
         if ($number === null) {
             throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointPar
ameters');
         }
-        if (($number > 543.2)) {
-            throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.');
+        if (($number > 543.200000000000045474735088646411895751953125)) {
+            throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.200000000000045474735088646411895751953125.');
         }
-        if (($number < 32.1)) {
-            throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.1.');
+        if (($number < 32.10000000000000142108547152020037174224853515625)) {
+            throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 32.10000000000000142108547152020037174224853515625.');
         }
 
         // verify the required parameter 'double' is set
         if ($double === null) {
             throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters');
         }
-        if (($double > 123.4)) {
-            throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.');
+        if (($double > 123.400000000000005684341886080801486968994140625)) {
+            throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.400000000000005684341886080801486968994140625.');
         }
-        if (($double < 67.8)) {
-            throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.8.');
+        if (($double < 67.7999999999999971578290569595992565155029296875)) {
+            throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 67.7999999999999971578290569595992565155029296875.');
         }

We need a proper value of converting the BigDecimal to string

Swagger-codegen version

Latest master

Swagger declaration file content or url

Swagger Petstore

Command line used for generation

./bin/php-petstore.sh

Steps to reproduce
./bin/php-petstore.sh
git diff

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions