Decathlon / Decathlon/tzatziki

dotNotationToYamlObject breaks content

Open
#708 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
87
Forks
42
Avg merge
4d 7h
Merged PRs (30d)
32

Description

**Description:**
com.decathlon.tzatziki.utils.Mapper#dotNotationToYamlObject:
When passing as argument an array of XMLs the conversion of dotNotationToYamlObject splits the xml.
For example the yaml:
```
- "\n\n\t"
```

will be returned as
```
- "\n\n\t"
```

This is because the regex for the dot notations is too permissive: (?>([ \-]*))(?![ "']*\?e)([^.:]+)\.((?>[^:]+)(?([ \\-]*))" + matchOnlyIfNonRegexFlag + "(\\w+)\\.((?>[^:]+)(?\\n\\n\\t"]
""".trim().stripIndent(),
Mapper.toYaml("""
- "\\n\\n\\t"
""".trim().stripIndent()));
}
```
- Implement read() for lists in TestMapperDelegate
```java
@Override
public E read(String content, Class clazz) {
if (clazz == List.class) {
return (E) readAsList(content);
}
return null;
}

public List readAsList(String content) {
return List.of(content);
}
```

**Workaround**
use `Mapper.shouldConvertDotPropertiesToObject(false);` in your local steps

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.