summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-06-28 15:34:47 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-29 10:31:23 +0000
commit2e4af1e0c0611851f450b2e215485064f6795958 (patch)
tree2c766e17841c24dc40faa98ff260234ea2cfa80a /catalog-be/src/test
parent6d4057b032a30daa8388f9f1a323eae1581eb91c (diff)
Implement YAML Validator
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I0365d4160984e4d68906959fb801ec7da5449b77 Issue-ID: SDC-4537
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java76
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFilesTest.java131
-rw-r--r--catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml10
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml1
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml1
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml2
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml3
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml4
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml4
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml5
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml6
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml7
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml7
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml9
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml14
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml20
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml85
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml84
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml83
-rw-r--r--catalog-be/src/test/resources/yamlValidation/noValid/schema.json121
20 files changed, 596 insertions, 77 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java
deleted file mode 100644
index 839095f1ca..0000000000
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFiles.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.be.tosca;
-
-import org.junit.Test;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class SchemaFiles {
-
- @Test
- public void testValidateYamlNormativeFiles(){
- String importToscaPath = "src/main/resources/import/tosca";
- assertTrue(checkValidYamlInFileTree(importToscaPath));
- }
-
- @Test
- public void testRainyYamlNormativeFiles(){
- String importToscaPathTest = "src/test/resources/yamlValidation";
- assertFalse(checkValidYamlInFileTree(importToscaPathTest));
- }
-
- private boolean checkValidYamlInFileTree(String fileTree) {
-
- try {
- List<Path> fileTreeYamlList = Files.walk(Paths.get(fileTree))
- .filter(path -> path.getFileName().toString().toLowerCase().endsWith(".yml"))
- .collect(Collectors.toList());
-
- for (Path yamlFile : fileTreeYamlList) {
- try {
- FileInputStream inputStream = new FileInputStream(yamlFile.toAbsolutePath().toString());
- Yaml yaml = new Yaml();
- Object content = yaml.load(inputStream);
- } catch (Exception e) {
- System.out.println("Not valid yaml in file creation : " + yamlFile.toAbsolutePath().toString());
- return false;
- }
- }
- } catch (IOException e) {
- System.out.println("Error in reading file from folder : " + fileTree);
- return false;
- }
- return true;
- }
-
-
-}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFilesTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFilesTest.java
new file mode 100644
index 0000000000..ddcf649c22
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/SchemaFilesTest.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.tosca;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import com.networknt.schema.JsonSchemaFactory;
+import com.networknt.schema.SpecVersion;
+import com.networknt.schema.ValidationMessage;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Stream;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.test.util.TestResourcesHandler;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.parser.ParserException;
+import org.yaml.snakeyaml.scanner.ScannerException;
+
+class SchemaFilesTest {
+
+ @Test
+ void testValidateYamlNormativeFiles() {
+ String importToscaPath = "src/main/resources/import/tosca";
+ assertTrue(checkValidYamlInFileTree(importToscaPath));
+ }
+
+ @Test
+ void testRainyYamlNormativeFiles() {
+ String importToscaPathTest = "src/test/resources/yamlValidation";
+ assertFalse(checkValidYamlInFileTree(importToscaPathTest));
+ }
+
+ private boolean checkValidYamlInFileTree(final String fileTree) {
+ AtomicBoolean ret = new AtomicBoolean(true);
+ try (final Stream<Path> pathStream = Files.walk(Paths.get(fileTree))) {
+ pathStream
+ .filter(path -> path.getFileName().toString().toLowerCase().endsWith(".yml"))
+ .forEach(yamlFile -> {
+ try {
+ new Yaml().load(new FileInputStream(yamlFile.toAbsolutePath().toString()));
+ } catch (final Exception e) {
+ System.out.println("Not valid yaml in file creation : " + yamlFile.toAbsolutePath());
+ ret.set(false);
+ }
+ });
+ } catch (final IOException e) {
+ System.out.println("Error in reading file from folder : " + fileTree);
+ return false;
+ }
+ return ret.get();
+ }
+
+ @Test
+ void yamlValidation_test_no_valid() {
+ final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ final JsonSchemaFactory factory =
+ JsonSchemaFactory.builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V202012)).objectMapper(mapper).build();
+
+ try (final Stream<Path> pathStream = Files.walk(Paths.get("src/test/resources/yamlValidation"))) {
+ pathStream
+ .filter(path -> path.getFileName().toString().toLowerCase().startsWith("data_types_no-valid-"))
+ .forEach(path -> {
+ try (final InputStream schemaFile = TestResourcesHandler.getResourceAsStream("yamlValidation/noValid/" + "schema.json");
+ final InputStream yamlFile = TestResourcesHandler.getResourceAsStream("yamlValidation/noValid/" + path.getFileName())) {
+ final Set<ValidationMessage> validationMessages = factory.getSchema(schemaFile).validate(mapper.readTree(yamlFile));
+ validationMessages.forEach(System.out::println);
+ assertFalse(validationMessages.isEmpty());
+ } catch (JsonParseException e) {
+ assertTrue(e.getCause() instanceof ParserException || e.getCause() instanceof ScannerException);
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ });
+ } catch (final IOException e) {
+ fail(e.getMessage());
+ }
+ }
+ @Test
+ void yamlValidation_test_valid() {
+ final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ final JsonSchemaFactory factory =
+ JsonSchemaFactory.builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V202012)).objectMapper(mapper).build();
+
+ try (final Stream<Path> pathStream = Files.walk(Paths.get("src/test/resources/yamlValidation"))) {
+ pathStream
+ .filter(path -> path.getFileName().toString().toLowerCase().startsWith("data_types_valid-"))
+ .forEach(path -> {
+ try (final InputStream schemaFile = TestResourcesHandler.getResourceAsStream("yamlValidation/noValid/" + "schema.json");
+ final InputStream yamlFile = TestResourcesHandler.getResourceAsStream("yamlValidation/noValid/" + path.getFileName())) {
+ final Set<ValidationMessage> validationMessages = factory.getSchema(schemaFile).validate(mapper.readTree(yamlFile));
+ validationMessages.forEach(System.out::println);
+ assertTrue(validationMessages.isEmpty());
+ } catch (IOException e) {
+ fail(e.getMessage());
+ }
+ });
+ } catch (final IOException e) {
+ fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml
index 6911570d16..0937c1d58e 100644
--- a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml
+++ b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml
@@ -2872,4 +2872,12 @@ errors:
code: 409,
message: "System deployed %1 cannot be archived. Component: '%2'",
messageId: "SVC4018"
- } \ No newline at end of file
+ }
+
+ #---------SVC4010-----------------------------
+ # %1 - error's list
+ YAML_IS_INVALID: {
+ code: 402,
+ message: "Error: Uploaded YAML file is invalid.\n%1",
+ messageId: "SVC4010"
+ }
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml
new file mode 100644
index 0000000000..ca05128ddd
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-001.yaml
@@ -0,0 +1 @@
+tosca_definitions_version:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml
new file mode 100644
index 0000000000..ca05128ddd
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-002.yaml
@@ -0,0 +1 @@
+tosca_definitions_version:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml
new file mode 100644
index 0000000000..85683a0e63
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-003.yaml
@@ -0,0 +1,2 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml
new file mode 100644
index 0000000000..ae209d17da
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-004.yaml
@@ -0,0 +1,3 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml
new file mode 100644
index 0000000000..00d452c440
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-005.yaml
@@ -0,0 +1,4 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml
new file mode 100644
index 0000000000..74e2c8a114
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-006.yaml
@@ -0,0 +1,4 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml
new file mode 100644
index 0000000000..6eb68d05d8
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-007.yaml
@@ -0,0 +1,5 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml
new file mode 100644
index 0000000000..21b54453b2
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-008.yaml
@@ -0,0 +1,6 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml
new file mode 100644
index 0000000000..00073a3cac
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-009.yaml
@@ -0,0 +1,7 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml
new file mode 100644
index 0000000000..2ccb8dd3fa
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-010.yaml
@@ -0,0 +1,7 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type: map
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml
new file mode 100644
index 0000000000..d7e219726f
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-011.yaml
@@ -0,0 +1,9 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type: map
+ entry_schema:
+ type:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml
new file mode 100644
index 0000000000..8e9ade8473
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-012.yaml
@@ -0,0 +1,14 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_2:
+ type: map
+ entry_schema:
+ type: boolean
+ descriptor_id:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml
new file mode 100644
index 0000000000..bfc5f2a48f
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_no-valid-013.yaml
@@ -0,0 +1,20 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_1:
+ type: list
+ entry_schema:
+ type: boolean
+ default: [
+ pr_2:
+ type: map
+ entry_schema:
+ type: boolean
+ default: }
+ descriptor_id:
+ type: string
+ description: Globally unique identifier of the VNFD
+ default: 'Missing quote
+ required: true
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml
new file mode 100644
index 0000000000..991477ccbd
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-01.yaml
@@ -0,0 +1,85 @@
+tosca_definitions_version: tosca_simple_yaml_1_2
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_1:
+ type: map
+ entry_schema:
+ type: boolean
+ pr_2:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - equal: fgh
+ pr_3:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - greater_than: a
+ pr_4:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - greater_or_equal: b
+ pr_5:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - less_than: z
+ pr_6:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - less_or_equal: y
+ pr_7:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - in_range:
+ - bb
+ - yy
+ pr_8:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - valid_values:
+ - dd
+ - rr
+ pr_9:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - length: 3
+ pr_10:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - min_length: 3
+ pr_11:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - min_length: 3
+ pr_12:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - max_length: 3
+ pr_13:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - pattern: '[a-z]'
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml
new file mode 100644
index 0000000000..d4ba271134
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-02.yaml
@@ -0,0 +1,84 @@
+data_types:
+ datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_1:
+ type: map
+ entry_schema:
+ type: boolean
+ pr_2:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - equal: fgh
+ pr_3:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - greater_than: a
+ pr_4:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - greater_or_equal: b
+ pr_5:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - less_than: z
+ pr_6:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - less_or_equal: y
+ pr_7:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - in_range:
+ - bb
+ - yy
+ pr_8:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - valid_values:
+ - dd
+ - rr
+ pr_9:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - length: 3
+ pr_10:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - min_length: 3
+ pr_11:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - min_length: 3
+ pr_12:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - max_length: 3
+ pr_13:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - pattern: '[a-z]'
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml
new file mode 100644
index 0000000000..a15f36899f
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/data_types_valid-03.yaml
@@ -0,0 +1,83 @@
+datatype_test:
+ derived_from: tosca.datatypes.Root
+ properties:
+ pr_1:
+ type: map
+ entry_schema:
+ type: boolean
+ pr_2:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - equal: fgh
+ pr_3:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - greater_than: a
+ pr_4:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - greater_or_equal: b
+ pr_5:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - less_than: z
+ pr_6:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - less_or_equal: y
+ pr_7:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - in_range:
+ - bb
+ - yy
+ pr_8:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - valid_values:
+ - dd
+ - rr
+ pr_9:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - length: 3
+ pr_10:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - min_length: 3
+ pr_11:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - min_length: 3
+ pr_12:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - max_length: 3
+ pr_13:
+ type: string
+ description: Globally unique identifier of the VNFD
+ required: true
+ constraints:
+ - pattern: '[a-z]'
diff --git a/catalog-be/src/test/resources/yamlValidation/noValid/schema.json b/catalog-be/src/test/resources/yamlValidation/noValid/schema.json
new file mode 100644
index 0000000000..df43dc4fe3
--- /dev/null
+++ b/catalog-be/src/test/resources/yamlValidation/noValid/schema.json
@@ -0,0 +1,121 @@
+{
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "http://example.com/example.json",
+ "title": "Root Schema",
+ "type": "object",
+ "default": {},
+ "properties": {
+ "tosca_definitions_version": {
+ "title": "The tosca_definitions_version Schema",
+ "type": "string",
+ "default": ""
+ },
+ "data_types": {
+ "title": "The data_types Schema",
+ "type": "object",
+ "default": {},
+ "required": [],
+ "additionalProperties": {
+ "title": "The additionalProperties Schema",
+ "type": "object",
+ "default": {},
+ "required": [
+ "derived_from",
+ "properties"
+ ],
+ "properties": {
+ "derived_from": {
+ "title": "The derived_from Schema",
+ "type": "string",
+ "default": ""
+ },
+ "properties": {
+ "title": "The properties Schema",
+ "type": "object",
+ "default": {},
+ "required": [],
+ "additionalProperties": {
+ "title": "The additionalProperties Schema",
+ "type": "object",
+ "default": {},
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "title": "The type Schema",
+ "type": "string",
+ "default": ""
+ },
+ "description": {
+ "title": "The description Schema",
+ "type": "string",
+ "default": ""
+ },
+ "default": {
+ "title": "The default Schema",
+ "type": [
+ "string",
+ "integer",
+ "boolean",
+ "number"
+ ],
+ "default": ""
+ },
+ "required": {
+ "title": "The required Schema",
+ "type": "boolean",
+ "default": false
+ },
+ "status": {
+ "title": "The status Schema",
+ "type": "string",
+ "default": ""
+ },
+ "constraints": {
+ "title": "The constraints Schema",
+ "type": [
+ "array"
+ ],
+ "default": {}
+ },
+ "entry_schema": {
+ "title": "The entry_schema Schema",
+ "type": "object",
+ "default": {},
+ "properties": {
+ "type": {
+ "title": "The type Schema",
+ "type": [
+ "string",
+ "integer",
+ "boolean",
+ "number"
+ ],
+ "default": ""
+ }
+ }
+ }
+ },
+ "if": {
+ "properties": {
+ "type": {
+ "enum": [
+ "map",
+ "list"
+ ]
+ }
+ }
+ },
+ "then": {
+ "required": [
+ "entry_schema"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}