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

Commit

Permalink
Asserting that string boolean examples are converted to real booleans.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Ursenbach committed Mar 29, 2019
1 parent dd87869 commit 0021509
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 0021509

Please sign in to comment.