[ 
https://issues.apache.org/jira/browse/GROOVY-12357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113655#comment-18113655
 ] 

ASF GitHub Bot commented on GROOVY-12357:
-----------------------------------------

codecov-commenter commented on PR #2919:
URL: https://github.com/apache/groovy/pull/2919#issuecomment-5612658983

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2919?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 71.2010%. Comparing base 
([`a6911ea`](https://app.codecov.io/gh/apache/groovy/commit/a6911ea2b34b1bc5597d82b122aedf5ff1ffc94c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`17e735d`](https://app.codecov.io/gh/apache/groovy/commit/17e735d36fafa52ca79c869435c990ee8676a57e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2919/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2919?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2919        +/-   ##
   ==================================================
   + Coverage     71.2007%   71.2010%   +0.0003%     
   - Complexity      37704      37713         +9     
   ==================================================
     Files            1584       1584                
     Lines          136434     136463        +29     
     Branches        25348      25353         +5     
   ==================================================
   + Hits            97142      97163        +21     
   - Misses          30535      30537         +2     
   - Partials         8757       8763         +6     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2919?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...vy-toml/src/main/java/groovy/toml/TomlSlurper.java](https://app.codecov.io/gh/apache/groovy/pull/2919?src=pr&el=tree&filepath=subprojects%2Fgroovy-toml%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Ftoml%2FTomlSlurper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LXRvbWwvc3JjL21haW4vamF2YS9ncm9vdnkvdG9tbC9Ub21sU2x1cnBlci5qYXZh)
 | `87.0968% <100.0000%> (+4.4881%)` | :arrow_up: |
   | 
[...vy-yaml/src/main/java/groovy/yaml/YamlSlurper.java](https://app.codecov.io/gh/apache/groovy/pull/2919?src=pr&el=tree&filepath=subprojects%2Fgroovy-yaml%2Fsrc%2Fmain%2Fjava%2Fgroovy%2Fyaml%2FYamlSlurper.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VicHJvamVjdHMvZ3Jvb3Z5LXlhbWwvc3JjL21haW4vamF2YS9ncm9vdnkveWFtbC9ZYW1sU2x1cnBlci5qYXZh)
 | `93.1034% <100.0000%> (+2.6273%)` | :arrow_up: |
   
   ... and [13 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2919/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> YamlSlurper and TomlSlurper: offer the date handling JsonSlurper has 
> (defaults unchanged)
> -----------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12357
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12357
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Paul King
>            Priority: Major
>
> GROOVY-12352 gave {{JsonSlurper}} a choice of what a date-like string becomes 
> — {{STRING}}, {{UTIL_DATE}}, {{INSTANT}} or {{OFFSET_DATE_TIME}}, selected 
> with {{setDateHandling}}. The other slurpers have no equivalent: a timestamp 
> in YAML or TOML is always a {{String}} on the untyped path.
> {code}
> new YamlSlurper().parseText('when: 2026-09-05T10:00:00Z').when   // String
> new TomlSlurper().parseText('when = 2026-09-05T10:00:00Z').when  // String
> {code}
> That is worth keeping as the default and offering a way out of, which is the 
> reverse of the JSON situation. {{JsonDateHandling}} exists because two of the 
> JSON parser types were already converting and callers needed to steer it, so 
> its default preserves that behaviour. Nothing in YAML or TOML has ever 
> converted, so the default here is {{STRING}} and nothing changes for an 
> existing caller. Parity of capability, with each format keeping its own 
> status quo.
> h3. Proposal
> {code:java}
> public YamlSlurper setDateHandling(JsonDateHandling dateHandling)
> public TomlSlurper setDateHandling(JsonDateHandling dateHandling)
> {code}
> defaulting to {{JsonDateHandling.STRING}}.
> Reusing the JSON enum is deliberate rather than expedient. The untyped paths 
> of both slurpers already read by converting the document to JSON text and 
> handing it to a {{JsonSlurper}}, so the type in the signature names what 
> actually interprets the value. Verified end to end on that route:
> {code}
> when: 2026-09-05T10:00:00Z
>   -> {"when":"2026-09-05T10:00:00Z"}
>   -> OffsetDateTime 2026-09-05T10:00Z   (INDEX_OVERLAY + OFFSET_DATE_TIME)
> {code}
> Implementation is correspondingly small: when the handling is not {{STRING}}, 
> configure the internal slurper with a date-capable parser type and the 
> requested handling, and delegate.
> h3. What this deliberately is not
> * Not YAML {{!!timestamp}} semantics. The conversion applies the same lexical 
> rule JSON uses — a full ISO-8601 or JSON-date form converts, a bare date does 
> not — after the document has become JSON. Document it as JSON's rule, because 
> it is.
> * Not the typed path, which has had its answer since GROOVY-12012: declare 
> {{java.time}} fields on the target class and {{parseAs}} binds them.
> * Not {{CsvSlurper}}. CSV has no date syntax to recognise; a cell is text. It 
> can join later if wanted, but it is not part of this ticket.
> h3. Sequencing
> Additive, default-preserving, so it does not need to catch 6.0.0. The only 
> decision with an RC deadline is the one this ticket assumes: that 
> {{JsonDateHandling}}, shipping for the first time in 6.0.0, is the 
> family-wide type rather than a JSON-only one. If a format-neutral name is 
> preferred instead, that rename has to happen before the enum is released, not 
> here.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to