From ab6421bcf7b480f9955b6b4376554ec9677e71ed Mon Sep 17 00:00:00 2001 From: awudzins Date: Mon, 13 Jan 2020 11:43:08 +0100 Subject: Changed EventTransformation schema to be loaded only once Issue-ID: DCAEGEN2-1774 Signed-off-by: adamwudzinski Change-Id: I50f3da2c11201a40be948ab199aaca89bbbb38db --- src/main/java/org/onap/dcae/restapi/EventValidator.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main/java/org/onap/dcae/restapi/EventValidator.java') 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> 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); -- cgit 1.2.3-korg