Skip to content

Commit

Permalink
Merge pull request #1967 from ProgrammeVitam/story_13135
Browse files Browse the repository at this point in the history
Story #13135 (pastis): add "comment" on regex
  • Loading branch information
marob authored Jul 30, 2024
2 parents 1194f3f + 16a80c7 commit 230f7d1
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public class PuaData implements Serializable {
Boolean additionalProperties;
List<String> Enum;
String pattern;
Integer minLenght;
Integer maxLenght;
Integer minLength;
Integer maxLength;
Integer minimum;
Integer maximum;
Boolean exclusiveMinimum;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,11 @@ private ElementProperties getElementProperties(
break;
case MIN_LENGTH:
addPuaDataToElementIfNotPresent(childProfile);
childProfile.getPuaData().setMinLenght(childPua.getInt(k));
childProfile.getPuaData().setMinLength(childPua.getInt(k));
break;
case MAX_LENGTH:
addPuaDataToElementIfNotPresent(childProfile);
childProfile.getPuaData().setMaxLenght(childPua.getInt(k));
childProfile.getPuaData().setMaxLength(childPua.getInt(k));
break;
case MINIMUM:
addPuaDataToElementIfNotPresent(childProfile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public String getControlSchemaFromElementProperties(ElementProperties elementPro
// 4. Check if tree contains Management metadata
addPatternPropertiesForManagement(elementProperties, controlSchema);
List<ElementProperties> elementsForTree = puaPastisValidator.ignoreMetadata(elementProperties);
List<String> rerquiredElements = puaPastisValidator.getHeadRequired(elementsForTree);
if (CollectionUtils.isNotEmpty(rerquiredElements)) {
List<String> requiredElements = puaPastisValidator.getHeadRequired(elementsForTree);
if (CollectionUtils.isNotEmpty(requiredElements)) {
controlSchema.put(PuaPastisValidator.REQUIRED, puaPastisValidator.getHeadRequired(elementsForTree));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1049,14 +1049,7 @@ public void getMetaDataFromSeda(ElementProperties el, PuaMetadataDetails puaMeta
if (el.getCardinality() != null && puaMetadataDetails.getType().equals("array")) {
getMinAndMAxItems(el, puaMetadataDetails);
}
if (
!sedaElement.getElement().equals(COMPLEX) && el.getPuaData() != null && el.getPuaData().getPattern() != null
) {
puaMetadataDetails.setPattern(el.getPuaData().getPattern());
}
if (el.getPuaData() != null && el.getPuaData().getPattern() != null) {
puaMetadataDetails.setPattern(el.getPuaData().getPattern());
}
Optional.ofNullable(el.getPuaData()).map(PuaData::getPattern).ifPresent(puaMetadataDetails::setPattern);
if (el.getPuaData() != null && el.getPuaData().getEnum() != null) {
puaMetadataDetails.setEnums(el.getPuaData().getEnum());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.json.JSONTokener;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
Expand All @@ -54,6 +53,8 @@
import java.io.InputStream;
import java.io.InputStreamReader;

import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;

@RunWith(SpringRunner.class)
@TestPropertySource(locations = "/application-test.yml")
public class JsonFromPuaTest {
Expand All @@ -72,7 +73,7 @@ public void testImportOK() throws IOException {
InputStream inputStreamExpected = getClass().getClassLoader().getResourceAsStream("pua/profile_Expected.json");
tokener = new JSONTokener(inputStreamExpected);
JSONObject fileNodeJSONExpected = new JSONObject(tokener);
JSONAssert.assertEquals(fileNodeJSONActual, fileNodeJSONExpected, JSONCompareMode.STRICT);
assertEquals(fileNodeJSONExpected, fileNodeJSONActual, JSONCompareMode.STRICT);
}

@Test
Expand All @@ -90,7 +91,7 @@ public void testImportOK_with_management() throws IOException {
.getResourceAsStream("pua/profile_Expected_with_management.json");
tokener = new JSONTokener(inputStreamExpected);
JSONObject fileNodeJSONExpected = new JSONObject(tokener);
JSONAssert.assertEquals(fileNodeJSONActual, fileNodeJSONExpected, JSONCompareMode.STRICT);
assertEquals(fileNodeJSONExpected, fileNodeJSONActual, JSONCompareMode.STRICT);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@
{
"additionalProperties": false,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down Expand Up @@ -145,8 +145,8 @@
{
"additionalProperties": null,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down Expand Up @@ -270,8 +270,8 @@
{
"additionalProperties": false,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down Expand Up @@ -322,8 +322,8 @@
{
"additionalProperties": false,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
"puaData": {
"additionalProperties": false,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down Expand Up @@ -203,8 +203,8 @@
"puaData": {
"additionalProperties": null,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down Expand Up @@ -316,8 +316,8 @@
"puaData": {
"additionalProperties": false,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down Expand Up @@ -363,8 +363,8 @@
"puaData": {
"additionalProperties": false,
"pattern": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"minimum": null,
"maximum": null,
"exclusiveMinimum": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
],
"pattern": null,
"minimum": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"maximum": null,
"additionalProperties": null,
"exclusiveMaximum": null,
Expand Down Expand Up @@ -193,8 +193,8 @@
"enum": null,
"pattern": null,
"minimum": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"maximum": null,
"additionalProperties": false,
"exclusiveMaximum": null,
Expand Down Expand Up @@ -236,8 +236,8 @@
"enum": null,
"pattern": null,
"minimum": null,
"minLenght": null,
"maxLenght": null,
"minLength": null,
"maxLength": null,
"maximum": null,
"additionalProperties": false,
"exclusiveMaximum": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@
"exclusiveMinimum": null,
"pattern": null,
"enum": null,
"minLenght": null,
"maxLenght": null
"minLength": null,
"maxLength": null
}
}
],
Expand Down Expand Up @@ -198,8 +198,8 @@
"Item",
"OtherLevel"
],
"minLenght": null,
"maxLenght": null
"minLength": null,
"maxLength": null
}
},
{
Expand Down Expand Up @@ -289,8 +289,8 @@
"exclusiveMinimum": null,
"pattern": null,
"enum": null,
"minLenght": null,
"maxLenght": null
"minLength": null,
"maxLength": null
}
},
{
Expand Down Expand Up @@ -332,8 +332,8 @@
"exclusiveMinimum": null,
"pattern": null,
"enum": null,
"minLenght": null,
"maxLenght": null
"minLength": null,
"maxLength": null
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions ui/ui-frontend/projects/pastis/src/app/models/pua-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export interface PuaData {
additionalProperties?: boolean;
enum?: string[];
pattern?: string;
minLenght?: number;
maxLenght?: number;
minLength?: number;
maxLength?: number;
minimum?: number;
maximum?: number;
exclusiveMinimum?: boolean;
Expand Down
Loading

0 comments on commit 230f7d1

Please sign in to comment.