Skip to content

Conversation

marcalff
Copy link
Member

Contributes to #2481

This is a partial fix, to implement parser location, for better yaml error messages.

Changes

Please provide a brief description of the changes here.

  • Implement the "Location" of a yaml node in the parser

    • Make all document nodes point to the document root
    • Make the document root own the yaml parser that is used to create the document
    • Inspect a node location by following the links up to the document root, and then invoke the rapidyaml parser.
  • Implement a location property in yaml related exceptions

  • Change all the parsing code to pass the current yaml node as context, in case code needs to access a node location to raise an exception.

With all these changes, when the parser fails with an invalid schema exception, the exception contains:

  • the name of the yaml input file used
  • the line number, column number, and offset from the document start, where the error was detected.

This helps ease of use, so error messages about invalid config.yaml files point precisely at the error location.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@marcalff marcalff marked this pull request as ready for review October 14, 2025 20:39
@marcalff marcalff requested a review from a team as a code owner October 14, 2025 20:39
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.00%. Comparing base (767ef30) to head (2da734f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3693      +/-   ##
==========================================
+ Coverage   89.95%   90.00%   +0.05%     
==========================================
  Files         225      225              
  Lines        7273     7273              
==========================================
+ Hits         6542     6545       +3     
+ Misses        731      728       -3     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcalff marcalff added the pr:please-review This PR is ready for review label Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:please-review This PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant