Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix regex to allow dot between parameters in path #158

Merged
merged 2 commits into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public abstract class ValidationRule extends CombinedAllNodeVisitor implements I
}));
};

private static String PATH_MATCH_REGEX = "^(\\/[^{}\\/]*(\\{[a-zA-Z_][0-9a-zA-Z_]*\\})?)+$";
private static String SEG_MATCH_REGEX = "\\/([^{}\\/]*)(\\{([a-zA-Z_][0-9a-zA-Z_]*)\\})?";
private static String PATH_MATCH_REGEX = "^(\\/[^{}\\/]*(\\{[a-zA-Z_][0-9a-zA-Z_]*\\})?(\\.\\{[a-zA-Z_][0-9a-zA-Z_]*\\})?)+$";
private static String SEG_MATCH_REGEX = "[\\/\\.]([^{}\\/]*)(\\{([a-zA-Z_][0-9a-zA-Z_]*)\\})?";
private static String URL_MATCH_REGEX = "^(?!mailto:)(?:(?:http|https|ftp)://)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$";
private static String EMAIL_MATCH_REGEX = "^[\\w!#$%&'*+/=?`{|}~^-]+(?:\\.[\\w!#$%&'*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$";
private static String MIME_TYPE_MATCH_REGEX = "^.*\\/.*(;.*)?$";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,39 @@
}
}
}
},
"/pathstest28/{var1}.{var2}": {
"get": {
"description": "pathstest28 - path with dot (/pathstest28/{var1}.{var2}) - valid",
"parameters": [
{
"$ref": "#/components/parameters/var1"
},
{
"$ref": "#/components/parameters/var2"
}
],
"responses": {
"default": {
"description": "..."
}
}
}
},
"/pathstest28/test.{var1}": {
"get": {
"description": "pathstest28 - path with dot (/pathstest28/test.{var1}) - valid",
"parameters": [
{
"$ref": "#/components/parameters/var1"
}
],
"responses": {
"default": {
"description": "..."
}
}
}
}
},
"components": {
Expand Down