php: Do not HTML escape patterns

This commit is contained in:
Ville Skyttä 2016-08-29 21:45:03 +03:00
parent dd1ed12318
commit 8f98a6d6f5
2 changed files with 7 additions and 7 deletions

View File

@ -149,8 +149,8 @@ use \{{invokerPackage}}\ObjectSerializer;
} }
{{/minimum}} {{/minimum}}
{{#pattern}} {{#pattern}}
if ({{^required}}!is_null(${{paramName}}) && {{/required}}!preg_match("{{pattern}}", ${{paramName}})) { if ({{^required}}!is_null(${{paramName}}) && {{/required}}!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}}

View File

@ -155,8 +155,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{{/minimum}} {{/minimum}}
{{#pattern}} {{#pattern}}
if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{pattern}}", $this->container['{{name}}'])) { if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{{pattern}}}", $this->container['{{name}}'])) {
$invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{pattern}}."; $invalid_properties[] = "invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}.";
} }
{{/pattern}} {{/pattern}}
@ -209,7 +209,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
} }
{{/minimum}} {{/minimum}}
{{#pattern}} {{#pattern}}
if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { if (!preg_match("{{{pattern}}}", $this->container['{{name}}'])) {
return false; return false;
} }
{{/pattern}} {{/pattern}}
@ -270,8 +270,8 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
} }
{{/minimum}} {{/minimum}}
{{#pattern}} {{#pattern}}
if (!preg_match("{{pattern}}", ${{name}})) { if (!preg_match("{{{pattern}}}", ${{name}})) {
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.'); throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{{pattern}}}.');
} }
{{/pattern}} {{/pattern}}
{{/hasValidation}} {{/hasValidation}}