TomlTransformer implementation#1572
Conversation
PR Summary
Overall, the PR focuses on enhancing the transformation process into TOML format, adding flexibility and making data representation more standardized and readable. |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1572 +/- ##
============================================
- Coverage 92.51% 92.44% -0.07%
- Complexity 3332 3358 +26
============================================
Files 330 331 +1
Lines 6547 6620 +73
Branches 640 655 +15
============================================
+ Hits 6057 6120 +63
- Misses 338 344 +6
- Partials 152 156 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| writeSchema(sb, input, schema, ""); | ||
| int len = sb.length(); | ||
| int sepLen = LINE_SEPARATOR.length(); | ||
| if (len >= sepLen && sb.substring(len - sepLen).equals(LINE_SEPARATOR)) { |
There was a problem hiding this comment.
| if (len >= sepLen && sb.substring(len - sepLen).equals(LINE_SEPARATOR)) { | |
| if (sb.endsWith(LINE_SEPARATOR)) { |
could it be simplified like that?
There was a problem hiding this comment.
It's a StringBuilder, that doesn't have endsWith, unfortunately.
It can be first built, then checked with nicer endsWith and then the string can be cut again, but I assume that would be a bit less performant due to the string rebuild twice.
Let me know if you think it still makes sense to change
There was a problem hiding this comment.
ah, that's true
then if it is StringBuilder I think it is possible to use indexOf/lastIndexOf, something like
if (len >= sepLen && sb.lastIndexOf(LINE_SEPARATOR, len - sepLen) >= 0)then no need to create new strings
WDYT?
|
great to see new formats appearing |
|
Thanks @snuyanzin for the review, I've rebased the PR and extended the doc |
|
Thank you for your contribution @badoken |
Adding to the collection of Transformers (JsonTransformer, YamlTransformer etc.)
TOML support, to generate data in TOML format (specs).
The format is often used in Python and Rust.
The implementation is based on YamlTransformer and its tests structure