Skip to content

Commit

Permalink
Merge pull request swagger-api#4421 from wing328/fix_isfile_boolean
Browse files Browse the repository at this point in the history
Fix `isPrimitiveType` for file property
  • Loading branch information
wing328 authored and www2k committed Jan 2, 2017
1 parent 9724796 commit 04baf05
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,8 @@ public void setParameterBooleanFlagWithCodegenProperty(CodegenParameter paramete
parameter.isPrimitiveType = true;
} else if (Boolean.TRUE.equals(property.isFile)) {
parameter.isFile = true;
parameter.isPrimitiveType = true;
// file is *not* a primitive type
//parameter.isPrimitiveType = true;
} else if (Boolean.TRUE.equals(property.isDate)) {
parameter.isDate = true;
parameter.isPrimitiveType = true;
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/php/SwaggerClient-php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 1.0.0
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
- Build package: io.swagger.codegen.languages.PhpClientCodegen

## Requirements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Method | HTTP request | Description
To test \"client\" model

To test \"client\" model

### Example
```php
<?php
Expand Down Expand Up @@ -129,6 +131,8 @@ void (empty response body)
To test enum parameters

To test enum parameters

### Example
```php
<?php
Expand All @@ -141,7 +145,7 @@ $enum_header_string_array = array("enum_header_string_array_example"); // string
$enum_header_string = "-efg"; // string | Header parameter enum test (string)
$enum_query_string_array = array("enum_query_string_array_example"); // string[] | Query parameter enum test (string array)
$enum_query_string = "-efg"; // string | Query parameter enum test (string)
$enum_query_integer = 3.4; // float | Query parameter enum test (double)
$enum_query_integer = 56; // int | Query parameter enum test (double)
$enum_query_double = 1.2; // double | Query parameter enum test (double)

try {
Expand All @@ -162,7 +166,7 @@ Name | Type | Description | Notes
**enum_header_string** | **string**| Header parameter enum test (string) | [optional] [default to -efg]
**enum_query_string_array** | [**string[]**](../Model/string.md)| Query parameter enum test (string array) | [optional]
**enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
**enum_query_integer** | **float**| Query parameter enum test (double) | [optional]
**enum_query_integer** | **int**| Query parameter enum test (double) | [optional]
**enum_query_double** | **double**| Query parameter enum test (double) | [optional]

### Return type
Expand Down
20 changes: 10 additions & 10 deletions samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,18 +267,18 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi
if ($byte === null) {
throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters');
}
if (!is_null($integer) && ($integer > 100.0)) {
throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.');
if (!is_null($integer) && ($integer > 100)) {
throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.');
}
if (!is_null($integer) && ($integer < 10.0)) {
throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.');
if (!is_null($integer) && ($integer < 10)) {
throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.');
}

if (!is_null($int32) && ($int32 > 200.0)) {
throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.');
if (!is_null($int32) && ($int32 > 200)) {
throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.');
}
if (!is_null($int32) && ($int32 < 20.0)) {
throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.');
if (!is_null($int32) && ($int32 < 20)) {
throw new \InvalidArgumentException('invalid value for "$int32" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.');
}

if (!is_null($float) && ($float > 987.6)) {
Expand Down Expand Up @@ -406,7 +406,7 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi
* @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg)
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg)
* @param float $enum_query_integer Query parameter enum test (double) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @throws \Swagger\Client\ApiException on non-2xx response
* @return void
Expand All @@ -428,7 +428,7 @@ public function testEnumParameters($enum_form_string_array = null, $enum_form_st
* @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg)
* @param string[] $enum_query_string_array Query parameter enum test (string array) (optional)
* @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg)
* @param float $enum_query_integer Query parameter enum test (double) (optional)
* @param int $enum_query_integer Query parameter enum test (double) (optional)
* @param double $enum_query_double Query parameter enum test (double) (optional)
* @throws \Swagger\Client\ApiException on non-2xx response
* @return array of null, HTTP status code, HTTP response headers (array of strings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ public function getOrderByIdWithHttpInfo($order_id)
if ($order_id === null) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderById');
}
if (($order_id > 5.0)) {
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.0.');
if (($order_id > 5)) {
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.');
}
if (($order_id < 1.0)) {
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.');
if (($order_id < 1)) {
throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be bigger than or equal to 1.');
}

// parse inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,20 @@ public function __construct(array $data = null)
public function listInvalidProperties()
{
$invalid_properties = [];
if (!is_null($this->container['integer']) && ($this->container['integer'] > 100.0)) {
$invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.0.";
if (!is_null($this->container['integer']) && ($this->container['integer'] > 100)) {
$invalid_properties[] = "invalid value for 'integer', must be smaller than or equal to 100.";
}

if (!is_null($this->container['integer']) && ($this->container['integer'] < 10.0)) {
$invalid_properties[] = "invalid value for 'integer', must be bigger than or equal to 10.0.";
if (!is_null($this->container['integer']) && ($this->container['integer'] < 10)) {
$invalid_properties[] = "invalid value for 'integer', must be bigger than or equal to 10.";
}

if (!is_null($this->container['int32']) && ($this->container['int32'] > 200.0)) {
$invalid_properties[] = "invalid value for 'int32', must be smaller than or equal to 200.0.";
if (!is_null($this->container['int32']) && ($this->container['int32'] > 200)) {
$invalid_properties[] = "invalid value for 'int32', must be smaller than or equal to 200.";
}

if (!is_null($this->container['int32']) && ($this->container['int32'] < 20.0)) {
$invalid_properties[] = "invalid value for 'int32', must be bigger than or equal to 20.0.";
if (!is_null($this->container['int32']) && ($this->container['int32'] < 20)) {
$invalid_properties[] = "invalid value for 'int32', must be bigger than or equal to 20.";
}

if ($this->container['number'] === null) {
Expand Down Expand Up @@ -277,16 +277,16 @@ public function listInvalidProperties()
*/
public function valid()
{
if ($this->container['integer'] > 100.0) {
if ($this->container['integer'] > 100) {
return false;
}
if ($this->container['integer'] < 10.0) {
if ($this->container['integer'] < 10) {
return false;
}
if ($this->container['int32'] > 200.0) {
if ($this->container['int32'] > 200) {
return false;
}
if ($this->container['int32'] < 20.0) {
if ($this->container['int32'] < 20) {
return false;
}
if ($this->container['number'] === null) {
Expand Down Expand Up @@ -349,11 +349,11 @@ public function getInteger()
public function setInteger($integer)
{

if (!is_null($integer) && ($integer > 100.0)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.0.');
if (!is_null($integer) && ($integer > 100)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.');
}
if (!is_null($integer) && ($integer < 10.0)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.0.');
if (!is_null($integer) && ($integer < 10)) {
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.');
}

$this->container['integer'] = $integer;
Expand All @@ -378,11 +378,11 @@ public function getInt32()
public function setInt32($int32)
{

if (!is_null($int32) && ($int32 > 200.0)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.0.');
if (!is_null($int32) && ($int32 > 200)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.');
}
if (!is_null($int32) && ($int32 < 20.0)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.0.');
if (!is_null($int32) && ($int32 < 20)) {
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.');
}

$this->container['int32'] = $int32;
Expand Down

0 comments on commit 04baf05

Please sign in to comment.