Skip to content

Commit

Permalink
Merge pull request #201 from jr3cermak/master
Browse files Browse the repository at this point in the history
A little bugfix.
  • Loading branch information
mevdschee committed Mar 10, 2017
2 parents 88b7bdb + cefe7b4 commit 37f2e0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions api.php
Expand Up @@ -2429,7 +2429,10 @@ protected function swagger($settings) {
echo '"required":true,';
echo '"schema":{';
echo '"type": "object",';
echo '"required":'.json_encode(array_keys(array_filter($action['fields'],function($f){ return $f->required; }))).',';
$required_fields = array_keys(array_filter($action['fields'],function($f){ return $f->required; }));
if (count($required_fields) > 0) {
echo '"required":'.json_encode($required_fields).',';
}
echo '"properties": {';
foreach (array_keys($action['fields']) as $k=>$field) {
if ($k>0) echo ',';
Expand Down Expand Up @@ -2497,7 +2500,10 @@ protected function swagger($settings) {
echo '"required":true,';
echo '"schema":{';
echo '"type": "object",';
echo '"required":'.json_encode(array_keys(array_filter($action['fields'],function($f){ return $f->required; }))).',';
$required_fields = array_keys(array_filter($action['fields'],function($f){ return $f->required; }));
if (count($required_fields) > 0) {
echo '"required":'.json_encode($required_fields).',';
}
echo '"properties": {';
foreach (array_keys($action['fields']) as $k=>$field) {
if ($k>0) echo ',';
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.php
Expand Up @@ -450,7 +450,7 @@ public function testOptionsRequest()
{
$test = new API($this);
$test->options('/posts/2');
$test->expect('["Access-Control-Allow-Headers: Content-Type, X-XSRF-Token","Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST, DELETE, PATCH","Access-Control-Allow-Credentials: true","Access-Control-Max-Age: 1728000"]',false);
$test->expect('["Access-Control-Allow-Headers: Content-Type, X-XSRF-TOKEN","Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST, DELETE, PATCH","Access-Control-Allow-Credentials: true","Access-Control-Max-Age: 1728000"]',false);
}

public function testHidingPasswordColumn()
Expand Down

0 comments on commit 37f2e0d

Please sign in to comment.