#6012 - fixed mustache template for lumen server (#6013)

This commit is contained in:
Frank Fleige 2017-07-08 18:51:47 +02:00 committed by wing328
parent b7ffad9a21
commit 0274ba79ad
3 changed files with 11 additions and 11 deletions

View File

@ -33,37 +33,37 @@ use Illuminate\Support\Facades\Request;
{{#pathParams}} {{#pathParams}}
{{#hasValidation}} {{#hasValidation}}
{{#maxLength}} {{#maxLength}}
if (strlen(${{paramName}}]) > {{maxLength}}) { if (strlen(${{paramName}}) > {{maxLength}}) {
throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.');
} }
{{/maxLength}} {{/maxLength}}
{{#minLength}} {{#minLength}}
if (strlen(${{paramName}}]) < {{minLength}}) { if (strlen(${{paramName}}) < {{minLength}}) {
throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.');
} }
{{/minLength}} {{/minLength}}
{{#maximum}} {{#maximum}}
if (${{paramName}}] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { if (${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) {
throw new \InvalidArgumentException('invalid value for ${{paramName}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); throw new \InvalidArgumentException('invalid value for ${{paramName}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.');
} }
{{/maximum}} {{/maximum}}
{{#minimum}} {{#minimum}}
if (${{paramName}}] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { if (${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) {
throw new \InvalidArgumentException('invalid value for ${{paramName}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); throw new \InvalidArgumentException('invalid value for ${{paramName}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.');
} }
{{/minimum}} {{/minimum}}
{{#pattern}} {{#pattern}}
if (!preg_match("{{{pattern}}}", ${{paramName}}])) { if (!preg_match("{{{pattern}}}", ${{paramName}})) {
throw new \InvalidArgumentException('invalid value for ${{paramName}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.'); throw new \InvalidArgumentException('invalid value for ${{paramName}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.');
} }
{{/pattern}} {{/pattern}}
{{#maxItems}} {{#maxItems}}
if (count(${{paramName}}]) > {{maxItems}}) { if (count(${{paramName}}) > {{maxItems}}) {
throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.');
} }
{{/maxItems}} {{/maxItems}}
{{#minItems}} {{#minItems}}
if (count(${{paramName}}]) < {{minItems}}) { if (count(${{paramName}}) < {{minItems}}) {
throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); throw new \InvalidArgumentException('invalid length for ${{paramName}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.');
} }
{{/minItems}} {{/minItems}}

View File

@ -91,8 +91,8 @@ class FakeApi extends Controller
if (!isset($input['pattern_without_delimiter'])) { if (!isset($input['pattern_without_delimiter'])) {
throw new \InvalidArgumentException('Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters'); throw new \InvalidArgumentException('Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters');
} }
if (!preg_match("/^[A-Z].", $input['pattern_without_delimiter'])) { if (!preg_match("/^[A-Z].*/", $input['pattern_without_delimiter'])) {
throw new \InvalidArgumentException('invalid value for $pattern_without_delimiter when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z]..'); throw new \InvalidArgumentException('invalid value for $pattern_without_delimiter when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z].*/.');
} }
$pattern_without_delimiter = $input['pattern_without_delimiter']; $pattern_without_delimiter = $input['pattern_without_delimiter'];

View File

@ -103,10 +103,10 @@ class StoreApi extends Controller
$input = Request::all(); $input = Request::all();
//path params validation //path params validation
if ($order_id] > 5) { if ($order_id > 5) {
throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be smaller than or equal to 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) { if ($order_id < 1) {
throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be bigger than or equal to 1.'); throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be bigger than or equal to 1.');
} }