@@ -61,7 +61,7 @@ public OpenApiValidator() {
61
61
}
62
62
}
63
63
spec = new BufferedReader (new InputStreamReader (in , StandardCharsets .UTF_8 )).lines ().collect (Collectors .joining ("\n " ));
64
- openApiHelper = OpenApiHelper . init (spec );
64
+ openApiHelper = new OpenApiHelper (spec );
65
65
schemaValidator = new SchemaValidator (openApiHelper .openApi3 );
66
66
} catch (Exception e ) {
67
67
logger .error ("initial failed:" + e );
@@ -76,7 +76,7 @@ public OpenApiValidator() {
76
76
public OpenApiValidator (String openapiPath ) {
77
77
InputStream in = this .getClass ().getClassLoader ().getResourceAsStream (openapiPath );
78
78
spec = new BufferedReader (new InputStreamReader (in , StandardCharsets .UTF_8 )).lines ().collect (Collectors .joining ("\n " ));
79
- openApiHelper = OpenApiHelper . init (spec );
79
+ openApiHelper = new OpenApiHelper (spec );
80
80
schemaValidator = new SchemaValidator (openApiHelper .openApi3 );
81
81
}
82
82
@@ -87,7 +87,7 @@ public OpenApiValidator(String openapiPath) {
87
87
*/
88
88
public OpenApiValidator (InputStream openapi ) {
89
89
spec = new BufferedReader (new InputStreamReader (openapi , StandardCharsets .UTF_8 )).lines ().collect (Collectors .joining ("\n " ));
90
- openApiHelper = OpenApiHelper . init (spec );
90
+ openApiHelper = new OpenApiHelper (spec );
91
91
schemaValidator = new SchemaValidator (openApiHelper .openApi3 );
92
92
}
93
93
@@ -100,7 +100,7 @@ public OpenApiValidator(InputStream openapi) {
100
100
*/
101
101
public Status validateRequestPath (String requestURI , String httpMethod , RequestEntity requestEntity ) {
102
102
requireNonNull (openApiHelper , "openApiHelper object cannot be null" );
103
- final NormalisedPath requestPath = new ApiNormalisedPath (requestURI );
103
+ final NormalisedPath requestPath = new ApiNormalisedPath (requestURI , openApiHelper . basePath );
104
104
final Optional <NormalisedPath > maybeApiPath = openApiHelper .findMatchingApiPath (requestPath );
105
105
if (!maybeApiPath .isPresent ()) {
106
106
Status status = new Status ( STATUS_INVALID_REQUEST_PATH , requestPath .normalised ());
0 commit comments