forked from loafle/openapi-generator-original
Merge pull request #2716 from wing328/better_naming_pattern_function
Renmae toJSONSchemaPattern to toRegularExpression
This commit is contained in:
commit
59f9849ca0
@ -328,12 +328,12 @@ public class DefaultCodegen {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
|
||||
* Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
|
||||
*
|
||||
* @param pattern the pattern (regular expression)
|
||||
* @return properly-escaped pattern
|
||||
*/
|
||||
public String toJSONSchemaPattern(String pattern) {
|
||||
public String toRegularExpression(String pattern) {
|
||||
return escapeText(pattern);
|
||||
}
|
||||
|
||||
@ -1125,7 +1125,7 @@ public class DefaultCodegen {
|
||||
StringProperty sp = (StringProperty) p;
|
||||
property.maxLength = sp.getMaxLength();
|
||||
property.minLength = sp.getMinLength();
|
||||
property.pattern = toJSONSchemaPattern(sp.getPattern());
|
||||
property.pattern = toRegularExpression(sp.getPattern());
|
||||
|
||||
// check if any validation rule defined
|
||||
if (property.pattern != null || property.minLength != null || property.maxLength != null)
|
||||
@ -1828,7 +1828,7 @@ public class DefaultCodegen {
|
||||
p.exclusiveMinimum = qp.isExclusiveMinimum();
|
||||
p.maxLength = qp.getMaxLength();
|
||||
p.minLength = qp.getMinLength();
|
||||
p.pattern = toJSONSchemaPattern(qp.getPattern());
|
||||
p.pattern = toRegularExpression(qp.getPattern());
|
||||
p.maxItems = qp.getMaxItems();
|
||||
p.minItems = qp.getMinItems();
|
||||
p.uniqueItems = qp.isUniqueItems();
|
||||
|
Loading…
x
Reference in New Issue
Block a user