forked from loafle/openapi-generator-original
[PHP] Fix message for InvalidArgumentException(), when failing to test pattern (#12780)
* [BUGFIX] model_generic.mustache: Display property name instead of its value, when throwing InvalidArgumentExeption() for values not respecting a given pattern * [AUTOGENERATED] Generated files
This commit is contained in:
parent
ac9e595476
commit
1a44a5284a
@ -346,7 +346,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
|
|||||||
{{/minimum}}
|
{{/minimum}}
|
||||||
{{#pattern}}
|
{{#pattern}}
|
||||||
if ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) {
|
if ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) {
|
||||||
throw new \InvalidArgumentException("invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
|
throw new \InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}.");
|
||||||
}
|
}
|
||||||
{{/pattern}}
|
{{/pattern}}
|
||||||
{{#maxItems}}
|
{{#maxItems}}
|
||||||
|
@ -594,7 +594,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!is_null($string) && (!preg_match("/[a-z]/i", $string))) {
|
if (!is_null($string) && (!preg_match("/[a-z]/i", $string))) {
|
||||||
throw new \InvalidArgumentException("invalid value for $string when calling FormatTest., must conform to the pattern /[a-z]/i.");
|
throw new \InvalidArgumentException("invalid value for \$string when calling FormatTest., must conform to the pattern /[a-z]/i.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container['string'] = $string;
|
$this->container['string'] = $string;
|
||||||
@ -774,7 +774,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!is_null($pattern_with_digits) && (!preg_match("/^\\d{10}$/", $pattern_with_digits))) {
|
if (!is_null($pattern_with_digits) && (!preg_match("/^\\d{10}$/", $pattern_with_digits))) {
|
||||||
throw new \InvalidArgumentException("invalid value for $pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/.");
|
throw new \InvalidArgumentException("invalid value for \$pattern_with_digits when calling FormatTest., must conform to the pattern /^\\d{10}$/.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container['pattern_with_digits'] = $pattern_with_digits;
|
$this->container['pattern_with_digits'] = $pattern_with_digits;
|
||||||
@ -803,7 +803,7 @@ class FormatTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!is_null($pattern_with_digits_and_delimiter) && (!preg_match("/^image_\\d{1,3}$/i", $pattern_with_digits_and_delimiter))) {
|
if (!is_null($pattern_with_digits_and_delimiter) && (!preg_match("/^image_\\d{1,3}$/i", $pattern_with_digits_and_delimiter))) {
|
||||||
throw new \InvalidArgumentException("invalid value for $pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i.");
|
throw new \InvalidArgumentException("invalid value for \$pattern_with_digits_and_delimiter when calling FormatTest., must conform to the pattern /^image_\\d{1,3}$/i.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter;
|
$this->container['pattern_with_digits_and_delimiter'] = $pattern_with_digits_and_delimiter;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user