Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bin/php-openapi
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $inputFile = null;
$inputFormat = null;
$outputFile = null;
$outputFormat = null;
$silentMode = false;
foreach($argv as $k => $arg) {
if ($k == 0) {
continue;
Expand Down Expand Up @@ -67,6 +68,10 @@ foreach($argv as $k => $arg) {
error("Conflicting arguments: only one of --write-json or --write-yaml is allowed!", "usage");
}
break;
case '-s':
case '--silent':
$silentMode = true;
break;
case '-h':
case '--help':
case 'help':
Expand Down Expand Up @@ -118,7 +123,9 @@ switch ($command) {
$validator->validate($openApiData, (object)['$ref' => 'file://' . dirname(__DIR__) . '/schemas/openapi-v3.0.json']);

if ($validator->isValid() && empty($errors)) {
print_formatted("The supplied API Description \B\Gvalidates\C against the OpenAPI v3.0 schema.\n", STDERR);
if(!$silentMode) {
print_formatted("The supplied API Description \B\Gvalidates\C against the OpenAPI v3.0 schema.\n", STDERR);
}
exit(0);
}

Expand Down Expand Up @@ -307,6 +314,7 @@ Usage:
\Y--read-yaml\C force reading input as YAML. Auto-detect if not specified.
\Y--write-json\C force writing output as JSON. Auto-detect if not specified.
\Y--write-yaml\C force writing output as YAML. Auto-detect if not specified.
\Y-s, --silent\C silent mode. Will hide all success/information messages and only print errors.


EOF
Expand Down