diff --git a/DEPENDENCIES b/DEPENDENCIES index 083e281965..a7e7e144d2 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -45,7 +45,7 @@ maven/mavencentral/com.google.guava/failureaccess/1.0.1, Apache-2.0, approved, C maven/mavencentral/com.google.guava/guava/32.0.1-jre, Apache-2.0 AND CC0-1.0 AND CC-PDDC, approved, #8772 maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657 maven/mavencentral/com.google.j2objc/j2objc-annotations/2.8, Apache-2.0, approved, clearlydefined -maven/mavencentral/com.ibm.icu/icu4j/69.1, Unicode-TOU AND ICU AND BSD-3-Clause AND BSD-2-Clause, approved, CQ23850 +maven/mavencentral/com.ibm.icu/icu4j/74.2, , approved, #11936 maven/mavencentral/com.jayway.jsonpath/json-path/2.9.0, Apache-2.0, approved, clearlydefined maven/mavencentral/com.nimbusds/content-type/2.2, Apache-2.0, approved, clearlydefined maven/mavencentral/com.nimbusds/lang-tag/1.7, Apache-2.0, approved, clearlydefined @@ -197,9 +197,9 @@ maven/mavencentral/net.java.dev.jna/jna/5.12.1, Apache-2.0 OR LGPL-2.1-or-later, maven/mavencentral/net.javacrumbs.json-unit/json-unit-assertj/2.36.1, Apache-2.0, approved, clearlydefined maven/mavencentral/net.javacrumbs.json-unit/json-unit-core/2.36.1, Apache-2.0, approved, clearlydefined maven/mavencentral/net.javacrumbs.json-unit/json-unit-json-path/2.36.1, Apache-2.0, approved, clearlydefined -maven/mavencentral/net.jimblackler.jsonschemafriend/core/0.12.0, Apache-2.0, approved, #10911 -maven/mavencentral/net.jimblackler.jsonschemafriend/extra/0.12.0, Apache-2.0, approved, #10910 -maven/mavencentral/net.jimblackler/jsonschemafriend/0.12.0, Apache-2.0, approved, #10912 +maven/mavencentral/net.jimblackler.jsonschemafriend/core/0.12.4, Apache-2.0, approved, #10911 +maven/mavencentral/net.jimblackler.jsonschemafriend/extra/0.12.4, Apache-2.0, approved, #10910 +maven/mavencentral/net.jimblackler/jsonschemafriend/0.12.4, Apache-2.0, approved, #10912 maven/mavencentral/net.jodah/typetools/0.6.3, Apache-2.0, approved, clearlydefined maven/mavencentral/net.minidev/accessors-smart/2.4.11, Apache-2.0, approved, #7515 maven/mavencentral/net.minidev/accessors-smart/2.4.9, Apache-2.0, approved, #7515 @@ -358,10 +358,10 @@ maven/mavencentral/org.glassfish.jersey.media/jersey-media-json-jackson/3.1.5, E maven/mavencentral/org.glassfish.jersey.media/jersey-media-multipart/3.1.3, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jersey maven/mavencentral/org.glassfish.jersey.media/jersey-media-multipart/3.1.5, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jersey maven/mavencentral/org.glassfish/jakarta.json/2.0.1, EPL-2.0 OR GPL-2.0-only with Classpath-exception-2.0, approved, ee4j.jsonp -maven/mavencentral/org.graalvm.js/js/21.2.0, UPL-1.0 AND (MPL-2.0 AND LicenseRef-MIT-style) AND (BSD-3-Clause AND UPL-1.0) AND (GPL-2.0-only WITH Classpath-exception-2.0 AND UPL-1.0) AND (UPL-1.0 AND LicenseRef-Permission-Notice), approved, #10176 -maven/mavencentral/org.graalvm.regex/regex/21.2.0, UPL-1.0 AND (Unicode-TOU AND UPL-1.0), approved, #10181 -maven/mavencentral/org.graalvm.sdk/graal-sdk/21.2.0, UPL-1.0, approved, clearlydefined -maven/mavencentral/org.graalvm.truffle/truffle-api/21.2.0, UPL-1.0, approved, #10219 +maven/mavencentral/org.graalvm.js/js/21.3.9, UPL-1.0 AND (UPL-1.0 AND GPL-2.0-only WITH Classpath-exception-2.0) AND BSD-3-Clause AND MPL-2.0, approved, #6714 +maven/mavencentral/org.graalvm.regex/regex/21.3.9, UPL-1.0 AND Unicode-TOU, approved, #6719 +maven/mavencentral/org.graalvm.sdk/graal-sdk/21.3.9, UPL-1.0, approved, #6717 +maven/mavencentral/org.graalvm.truffle/truffle-api/21.3.9, UPL-1.0, approved, #6718 maven/mavencentral/org.hamcrest/hamcrest-core/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hamcrest/hamcrest/2.2, BSD-3-Clause, approved, clearlydefined maven/mavencentral/org.hdrhistogram/HdrHistogram/2.1.12, BSD-2-Clause OR LicenseRef-Public-Domain, approved, CQ13192 @@ -382,8 +382,8 @@ maven/mavencentral/org.jetbrains/annotations/17.0.0, Apache-2.0, approved, clear maven/mavencentral/org.jetbrains/annotations/24.0.1, Apache-2.0, approved, #7417 maven/mavencentral/org.jodd/jodd-lagarto/6.0.6, BSD-2-Clause, approved, clearlydefined maven/mavencentral/org.jodd/jodd-util/6.1.0, BSD-2-Clause, approved, clearlydefined -maven/mavencentral/org.jruby.jcodings/jcodings/1.0.55, MIT, approved, CQ10635 -maven/mavencentral/org.jruby.joni/joni/2.1.41, MIT, approved, CQ10636 +maven/mavencentral/org.jruby.jcodings/jcodings/1.0.58, MIT, approved, CQ10635 +maven/mavencentral/org.jruby.joni/joni/2.2.1, MIT, approved, #8771 maven/mavencentral/org.jsoup/jsoup/1.16.1, MIT, approved, #8462 maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133 maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.3, EPL-2.0, approved, #3133 diff --git a/irs-api/src/test/java/org/eclipse/tractusx/irs/services/validation/JsonValidatorServiceTest.java b/irs-api/src/test/java/org/eclipse/tractusx/irs/services/validation/JsonValidatorServiceTest.java index 9da9182d96..8e188c7681 100644 --- a/irs-api/src/test/java/org/eclipse/tractusx/irs/services/validation/JsonValidatorServiceTest.java +++ b/irs-api/src/test/java/org/eclipse/tractusx/irs/services/validation/JsonValidatorServiceTest.java @@ -34,12 +34,24 @@ import java.util.Objects; import org.eclipse.tractusx.irs.util.JsonUtil; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; class JsonValidatorServiceTest { private final JsonValidatorService testee = new JsonValidatorService(new JsonUtil()); + @Test + @Disabled("Should not pass validation, but currently payload is valid with schema v.3.0.0") + void shouldFailWhenSchemaIsInThirdVerAndPayloadInSecondVer() throws Exception { + final String schema = readFile("/json-schema/slab-v3.0.0.json"); + final String payload = readFile("/__files/integrationtesting/singleLevelBomAsBuilt-2.json"); + + final ValidationResult result = testee.validate(schema, payload); + + assertThat(result.isValid()).isFalse(); + } + @Test void shouldValidateAssemblyPartRelationship() throws Exception { final String schema = readFile("/json-schema/assemblyPartRelationship-v1.1.0.json"); diff --git a/irs-api/src/test/resources/json-schema/slab-v3.0.0.json b/irs-api/src/test/resources/json-schema/slab-v3.0.0.json new file mode 100644 index 0000000000..56f26d15f3 --- /dev/null +++ b/irs-api/src/test/resources/json-schema/slab-v3.0.0.json @@ -0,0 +1,103 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema", + "description" : "The single-level bill of material represents one sub-level of an assembly and does not include any lower-level subassemblies. The as-built lifecycle references all child items as manufactured by the manufacturer referencing only child items in an as-built lifecycle themselves (e.g. serial parts or batches), unless parts can only be tracked by an part ID (on a type level).\n\nIf it is unclear which item has been built-in into the parent item, all potential parts must be listed. This is the case when, e.g. the same item is supplied by two suppliers and the item is only tracked by a customer part ID during assembly, these items can not be differentiated from each other.\n", + "type" : "object", + "components" : { + "schemas" : { + "urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait" : { + "type" : "string", + "description" : "The provided regular expression ensures that the UUID is composed of five groups of characters separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 hexadecimal characters and 4 hyphens), optionally prefixed by \"urn:uuid:\" to make it an IRI.", + "pattern" : "(^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)|(^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$)" + }, + "urn_samm_io.catenax.single_level_bom_as_built_3.0.0_DateTimeTrait" : { + "type" : "string", + "description" : "Regular Expression to enable UTC and Timezone formats and the possibility to exclude time information.", + "pattern" : "^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?|(24:00:00(\\.0+)?))(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?$" + }, + "urn_samm_io.catenax.shared.quantity_2.0.0_QuantityValueCharacteristic" : { + "type" : "number", + "description" : "The quantity value associated with the unit expressed as float." + }, + "urn_samm_io.catenax.shared.quantity_2.0.0_ItemUnitEnumeration" : { + "type" : "string", + "pattern" : "[a-zA-Z]*:[a-zA-Z]+", + "description" : "Enumeration for common item units.", + "enum" : [ "unit:piece", "unit:set", "unit:pair", "unit:page", "unit:cycle", "unit:kilowattHour", "unit:gram", "unit:kilogram", "unit:tonneMetricTon", "unit:tonUsOrShortTonUkorus", "unit:ounceAvoirdupois", "unit:pound", "unit:metre", "unit:centimetre", "unit:kilometre", "unit:inch", "unit:foot", "unit:yard", "unit:squareCentimetre", "unit:squareMetre", "unit:squareInch", "unit:squareFoot", "unit:squareYard", "unit:cubicCentimetre", "unit:cubicMetre", "unit:cubicInch", "unit:cubicFoot", "unit:cubicYard", "unit:litre", "unit:millilitre", "unit:hectolitre", "unit:secondUnitOfTime", "unit:minuteUnitOfTime", "unit:hourUnitOfTime", "unit:day" ] + }, + "urn_samm_io.catenax.shared.quantity_2.0.0_ItemQuantityCharacteristic" : { + "description" : "Characteristic for measurements of an item (mass, count, linear, area, volume, misc).", + "type" : "object", + "properties" : { + "value" : { + "description" : "The quantity value associated with the unit.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.shared.quantity_2.0.0_QuantityValueCharacteristic" + }, + "unit" : { + "description" : "The unit of an item. Common units may be related to mass, count, linear, area, volume or misc.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.shared.quantity_2.0.0_ItemUnitEnumeration" + } + }, + "required" : [ "value", "unit" ] + }, + "urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait" : { + "type" : "string", + "description" : "The provided regular expression ensures that the BPNL is composed of prefix 'BPNL', 10 digits and two alphanumeric letters.", + "pattern" : "^BPNL[a-zA-Z0-9]{12}$" + }, + "urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean" : { + "type" : "boolean", + "description" : "Represents a boolean value (i.e. a \"flag\")." + }, + "urn_samm_io.catenax.single_level_bom_as_built_3.0.0_ChildData" : { + "description" : "Catena-X ID and meta data of the assembled child item.", + "type" : "object", + "properties" : { + "createdOn" : { + "description" : "Timestamp when the relation between the parent item and the child item was created, e.g. when the serialized child part was assembled into the given part.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.single_level_bom_as_built_3.0.0_DateTimeTrait" + }, + "quantity" : { + "description" : "Quantity of which the child item is assembled into the parent item. In general it is '1' for serialized parts.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.shared.quantity_2.0.0_ItemQuantityCharacteristic" + }, + "lastModifiedOn" : { + "description" : "Timestamp when the assembly relationship between parent item and child item was last modified.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.single_level_bom_as_built_3.0.0_DateTimeTrait" + }, + "businessPartner" : { + "description" : "The supplier of the given child item.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.shared.business_partner_number_2.0.0_BpnlTrait" + }, + "hasAlternatives" : { + "description" : "Expresses whether the part is built-in or wether it is one of several options. If the value is false, it can be assumed this exact item is built-in. If the value is true, it is unknown wether this or an alternative item is built-in.\nThis is the case when, e.g. the same item is supplied by two suppliers, the item is only tracked by a customer part ID during assembly. Thus, these items can not be differentiated from each other.\n\n", + "$ref" : "#/components/schemas/urn_samm_org.eclipse.esmf.samm_characteristic_2.1.0_Boolean" + }, + "catenaXId" : { + "description" : "The Catena-X ID of the given part (e.g. the component), valid for the Catena-X dataspace.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait" + } + }, + "required" : [ "createdOn", "quantity", "businessPartner", "hasAlternatives", "catenaXId" ] + }, + "urn_samm_io.catenax.single_level_bom_as_built_3.0.0_SetOfChildItemsCharacteristic" : { + "description" : "Set of child items the parent item was assembled by (one structural level down).", + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/urn_samm_io.catenax.single_level_bom_as_built_3.0.0_ChildData" + }, + "uniqueItems" : true + } + } + }, + "properties" : { + "catenaXId" : { + "description" : "The Catena-X ID of the given part (e.g. the component), valid for the Catena-X dataspace.", + "$ref" : "#/components/schemas/urn_samm_io.catenax.shared.uuid_2.0.0_UuidV4Trait" + }, + "childItems" : { + "description" : "Set of child items, of which the given parent item was assembled by (one structural level down).", + "$ref" : "#/components/schemas/urn_samm_io.catenax.single_level_bom_as_built_3.0.0_SetOfChildItemsCharacteristic" + } + }, + "required" : [ "catenaXId", "childItems" ] +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 471a4ee3c0..afc07ae225 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ 1.76 3.3.1 1.16.1 - 0.12.0 + 0.12.4 2.14.0 3.12.0 4.10.0