aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/dcae/restapi/EventValidator.java
diff options
context:
space:
mode:
authorawudzins <adam.wudzinski@nokia.com>2020-01-13 11:43:08 +0100
committerawudzins <adam.wudzinski@nokia.com>2020-01-17 14:39:20 +0100
commitab6421bcf7b480f9955b6b4376554ec9677e71ed (patch)
tree347d29e9629a04888daf1fd216284f15b72a7149 /src/main/java/org/onap/dcae/restapi/EventValidator.java
parent7e5a7d1d8cd74e42c8549e02724ec2df589e4117 (diff)
Changed EventTransformation schema to be loaded only once
Issue-ID: DCAEGEN2-1774 Signed-off-by: adamwudzinski <adam.wudzinski@nokia.com> Change-Id: I50f3da2c11201a40be948ab199aaca89bbbb38db
Diffstat (limited to 'src/main/java/org/onap/dcae/restapi/EventValidator.java')
-rw-r--r--src/main/java/org/onap/dcae/restapi/EventValidator.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/java/org/onap/dcae/restapi/EventValidator.java b/src/main/java/org/onap/dcae/restapi/EventValidator.java
index 009247c0..3261c3b3 100644
--- a/src/main/java/org/onap/dcae/restapi/EventValidator.java
+++ b/src/main/java/org/onap/dcae/restapi/EventValidator.java
@@ -3,7 +3,7 @@
* PROJECT
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2019 Nokia. All rights reserved.s
+ * Copyright (C) 2020 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,12 +20,10 @@
*/
package org.onap.dcae.restapi;
+import java.util.Optional;
import org.json.JSONObject;
import org.onap.dcae.ApplicationSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
-import java.util.Optional;
public class EventValidator {
private final SchemaValidator schemaValidator = new SchemaValidator();
@@ -36,7 +34,7 @@ public class EventValidator {
}
public Optional<ResponseEntity<String>> validate(JSONObject jsonObject, String type, String version){
- if (applicationSettings.jsonSchemaValidationEnabled()) {
+ if (applicationSettings.eventSchemaValidationEnabled()) {
if (jsonObject.has(type)) {
if (!schemaValidator.conformsToSchema(jsonObject, applicationSettings.jsonSchema(version))) {
return errorResponse(ApiException.SCHEMA_VALIDATION_FAILED);