diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-07-19 12:04:46 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2024-07-19 12:05:20 +0100 |
commit | 9133dabc8566458899d39a7223fcc9c43788febd (patch) | |
tree | 509cc81d37da3e31bb606383f4b21d68747899c6 /feature-lifecycle/src/main | |
parent | c295ebcf3e6c15510e9c0d9a1ae1dd206b403d73 (diff) |
Uplift json schema validator library
Issue-ID: POLICY-5084
Change-Id: I426cd992895d4ce4b840ac1ab479152f954cceaf
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'feature-lifecycle/src/main')
-rw-r--r-- | feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java index 6740700a..a4abdf37 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/server/restful/RestLifecycleManager.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021,2023 Nordix Foundation. + * Modifications Copyright (C) 2021, 2023-2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.onap.policy.drools.server.restful; -import com.worldturner.medeia.api.ValidationFailedException; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; import jakarta.ws.rs.GET; @@ -365,14 +364,13 @@ public class RestLifecycleManager implements LifecycleApi { return Response.status(Response.Status.NOT_ACCEPTABLE).build(); } - try { - LifecycleFeature.getFsm().getDomainMaker().conformance(toscaPolicy); - } catch (ValidationFailedException v) { - logger.trace("policy {} validation errors: {}", toscaPolicy, v.getMessage(), v); - return Response.status(Response.Status.NOT_ACCEPTABLE).entity(v.getFailures()).build(); + var isOk = LifecycleFeature.getFsm().getDomainMaker().conformance(toscaPolicy); + if (isOk) { + return Response.status(Response.Status.OK).entity(Collections.emptyList()).build(); + } else { + return Response.status(Response.Status.NOT_ACCEPTABLE).entity(Collections.emptyList()).build(); } - return Response.status(Response.Status.OK).entity(Collections.emptyList()).build(); } private Response deployUndeployOperation(String policy, boolean deploy) { |