Skip to content

fixes #18 upgrade the initiating OpenApiHelper after multiple specifi… #19

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

Merged
merged 1 commit into from
Sep 12, 2022
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
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mservicetech</groupId>
<artifactId>openapi-schema-validation</artifactId>
<version>2.0.3</version>
<version>2.0.4</version>
<packaging>jar</packaging>
<description>openapi schema for openpai 3.*</description>
<url>https://github.com/mservicetech/openapi-schema-validation</url>
Expand Down Expand Up @@ -57,13 +57,13 @@
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.json-schema-validator>1.0.69</version.json-schema-validator>
<version.light-4j>2.1.1</version.light-4j>
<version.jackson>2.12.1</version.jackson>
<version.light-4j>2.1.2-SNAPSHOT</version.light-4j>
<version.jackson>2.13.3</version.jackson>
<version.snakeyaml>1.26</version.snakeyaml>
<version.slf4j>1.7.32</version.slf4j>
<version.slf4j>1.7.36</version.slf4j>
<version.common-lang3>3.5</version.common-lang3>
<version.logback>1.2.3</version.logback>
<version.junit>4.12</version.junit>
<version.logback>1.2.11</version.logback>
<version.junit>4.13.1</version.junit>
<version.mockito>2.7.21</version.mockito>
<version.maven-javadoc>3.1.0</version.maven-javadoc>
<versions.maven-version>2.4</versions.maven-version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public OpenApiValidator() {
}
}
spec = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
openApiHelper = OpenApiHelper.init(spec);
openApiHelper = new OpenApiHelper(spec);
schemaValidator = new SchemaValidator(openApiHelper.openApi3);
} catch (Exception e) {
logger.error("initial failed:" + e);
Expand All @@ -76,7 +76,7 @@ public OpenApiValidator() {
public OpenApiValidator(String openapiPath) {
InputStream in = this.getClass().getClassLoader().getResourceAsStream(openapiPath);
spec = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
openApiHelper = OpenApiHelper.init(spec);
openApiHelper = new OpenApiHelper(spec);
schemaValidator = new SchemaValidator(openApiHelper.openApi3);
}

Expand All @@ -87,7 +87,7 @@ public OpenApiValidator(String openapiPath) {
*/
public OpenApiValidator(InputStream openapi) {
spec = new BufferedReader(new InputStreamReader(openapi, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
openApiHelper = OpenApiHelper.init(spec);
openApiHelper = new OpenApiHelper(spec);
schemaValidator = new SchemaValidator(openApiHelper.openApi3);
}

Expand All @@ -100,7 +100,7 @@ public OpenApiValidator(InputStream openapi) {
*/
public Status validateRequestPath (String requestURI , String httpMethod, RequestEntity requestEntity ) {
requireNonNull(openApiHelper, "openApiHelper object cannot be null");
final NormalisedPath requestPath = new ApiNormalisedPath(requestURI);
final NormalisedPath requestPath = new ApiNormalisedPath(requestURI, openApiHelper.basePath);
final Optional<NormalisedPath> maybeApiPath = openApiHelper.findMatchingApiPath(requestPath);
if (!maybeApiPath.isPresent()) {
Status status = new Status( STATUS_INVALID_REQUEST_PATH, requestPath.normalised());
Expand Down