feat: parse instance data paths#7
Open
HassanAkbar wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends Lutaml::Path.parse to support model-instance path syntax (dot navigation plus optional bracketed filter expressions) while preserving the existing element path (::) parsing. It introduces new value objects for instance paths and filter-condition AST nodes, and updates the README and specs accordingly.
Changes:
- Add
InstancePathandSteprepresentations to support dot navigation and attaching parsed filter conditions to individual steps. - Add a
ConditionAST (comparison/membership/existence/logical ops) and parsing rules with operator precedence and grouping. - Improve round-tripping (
to_s) and equality semantics for parsed paths; document the new behavior in the README.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/lutaml/path_spec.rb | Adds extensive coverage for instance-path parsing, filter forms, precedence/grouping, round-trips, and immutability expectations. |
| README.adoc | Documents operator precedence, literal forms, filter-vs-charset rules, and clarifies instance paths are parse-only for now. |
| lib/lutaml/path/parser.rb | Extends grammar to support dot navigation and filter condition parsing with a token-aware “filter sniff”. |
| lib/lutaml/path/transformer.rb | Transforms parse trees into ElementPath/InstancePath, Step, and Condition nodes (but currently contains runtime-breaking transform bugs). |
| lib/lutaml/path/step.rb | Introduces Step to compose PathSegment + optional condition and render appropriately. |
| lib/lutaml/path/path_segment.rb | Preserves raw source for round-tripping and adds value equality/hash; unescapes \:: and \. into name. |
| lib/lutaml/path/instance_path.rb | Adds parse-only InstancePath with structured steps, conditions, to_s, and explicit match? NotImplementedError. |
| lib/lutaml/path/element_path.rb | Makes ElementPath inherit AbstractPath and adds to_s/value equality/hash. |
| lib/lutaml/path/condition.rb | Adds immutable, renderable filter-condition AST node types (AttributeRef, Value, Comparison, etc.). |
| lib/lutaml/path/abstract_path.rb | Adds a common base type holding only absolute?. |
| lib/lutaml/path.rb | Updates require order and ensures parse consistently raises ParseError (including for deep nesting via SystemStackError). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #3