ion-rust icon indicating copy to clipboard operation
ion-rust copied to clipboard

Add location metadata to Element API

Open desaikd opened this issue 11 months ago • 0 comments

Purpose:

Customers that use Ion Rust’s Element API to manipulate Ion data can benefit from having more precise row-column information regarding the element. This helps identify the exact place of the element and can be useful for error messaging as well as debugging. Some general usecases:

  • Within ion-schema-rust library for better violation message with location to the Element that generated error in validation and to the schema constraint that was violated.
  • Use with ion-cli for schema related subcommands as well as for code generation.

Implementation:

Requires a change in the TextBuffer to have properties for row and column data based on offset and whitespace. This then can be pulled to higher abstraction layers like LazyValue and eventually to Element API. This might require a cargo flag for people to opt-in to this feature.

desaikd avatar Jan 17 '25 17:01 desaikd