@@ -61,7 +61,7 @@ public OpenApiValidator() {
6161 }
6262 }
6363 spec = new BufferedReader (new InputStreamReader (in , StandardCharsets .UTF_8 )).lines ().collect (Collectors .joining ("\n " ));
64- openApiHelper = OpenApiHelper . init (spec );
64+ openApiHelper = new OpenApiHelper (spec );
6565 schemaValidator = new SchemaValidator (openApiHelper .openApi3 );
6666 } catch (Exception e ) {
6767 logger .error ("initial failed:" + e );
@@ -76,7 +76,7 @@ public OpenApiValidator() {
7676 public OpenApiValidator (String openapiPath ) {
7777 InputStream in = this .getClass ().getClassLoader ().getResourceAsStream (openapiPath );
7878 spec = new BufferedReader (new InputStreamReader (in , StandardCharsets .UTF_8 )).lines ().collect (Collectors .joining ("\n " ));
79- openApiHelper = OpenApiHelper . init (spec );
79+ openApiHelper = new OpenApiHelper (spec );
8080 schemaValidator = new SchemaValidator (openApiHelper .openApi3 );
8181 }
8282
@@ -87,7 +87,7 @@ public OpenApiValidator(String openapiPath) {
8787 */
8888 public OpenApiValidator (InputStream openapi ) {
8989 spec = new BufferedReader (new InputStreamReader (openapi , StandardCharsets .UTF_8 )).lines ().collect (Collectors .joining ("\n " ));
90- openApiHelper = OpenApiHelper . init (spec );
90+ openApiHelper = new OpenApiHelper (spec );
9191 schemaValidator = new SchemaValidator (openApiHelper .openApi3 );
9292 }
9393
@@ -100,7 +100,7 @@ public OpenApiValidator(InputStream openapi) {
100100 */
101101 public Status validateRequestPath (String requestURI , String httpMethod , RequestEntity requestEntity ) {
102102 requireNonNull (openApiHelper , "openApiHelper object cannot be null" );
103- final NormalisedPath requestPath = new ApiNormalisedPath (requestURI );
103+ final NormalisedPath requestPath = new ApiNormalisedPath (requestURI , openApiHelper . basePath );
104104 final Optional <NormalisedPath > maybeApiPath = openApiHelper .findMatchingApiPath (requestPath );
105105 if (!maybeApiPath .isPresent ()) {
106106 Status status = new Status ( STATUS_INVALID_REQUEST_PATH , requestPath .normalised ());
0 commit comments