Skip to content

Commit 82cd15a

Browse files
author
Chris Wiechmann
committed
Break, Path-Search, if no more paths are given
1 parent ec68123 commit 82cd15a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/axway/apim/openapi/validator/OpenAPIValidator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ public boolean isValidRequest(String payload, String verb, String path, QueryStr
129129
* For example: /great-petstore/pet/31233 will not find anything in the first attempt, because the
130130
* API does not exist with /great-petstore in the API-Spec. This process is repeated at most 5 times.
131131
*/
132-
if(path.indexOf("/", 1)!=-1) {
132+
if(path.indexOf("/", 1)==-1) {
133+
break; // No need to continue as there is only a single path left (/petstore)
134+
} else {
133135
path = path.substring(path.indexOf("/", 1), path.length());
134136
}
135137
} else {

0 commit comments

Comments
 (0)