Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #229 from vimeo/openapi-booleans-as-booleans
Browse files Browse the repository at this point in the history
Asserting that string boolean examples are converted to real booleans.
  • Loading branch information
erunion authored Mar 29, 2019
2 parents dd87869 + 0021509 commit 2815fe0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Compiler/Specification/OpenApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ protected function convertSampleDataToCompatibleDataType($data, string $type)
{
// Booleans in OpenAPI specifications should be represented as booleans, not stringified versions of booleans.
if ($type === 'boolean') {
if ($data === '0') {
if ($data === '0' || $data === 'false') {
return false;
} elseif ($data === '1') {
} elseif ($data === '1' || $data === 'true') {
return true;
}
}
Expand Down

0 comments on commit 2815fe0

Please sign in to comment.