Repository navigation
Conversation
Instance paths were parse-only: InstancePath#match? raised by design rather than silently matching names while ignoring conditions. This adds the evaluation half: - Resolver walks InstancePath#steps over lutaml-model Serializable instances, hashes, and enumerables: base steps anchor the root, attribute steps read named children (segment patterns via the existing fnmatch contract), ** selects every descendant, and step conditions filter the candidates. - ConditionEvaluator evaluates the Condition AST (comparisons with numeric coercion and FNM_EXTGLOB wildcard values, list membership, existence, &&/||/!) against the same name-resolution. - Lutaml::Path.resolve(root, path) and InstancePath#resolve: plain chains resolve to a single value; filters, patterns, and deep wildcards return collections. - gemspec: lutaml-model (>= 0.8) joins parslet — resolution reads model attributes through the Serializable contract. The parser, AST, and the 87 existing examples are untouched; the new specs port RS 3002's own instance-data examples (the contributor/organization/role/docidentifier corpus) end-to-end. Suite 98/0; rubocop clean.
- Gemfile.lock was committed with a darwin-only resolution; the repo does not track a lockfile, so it is removed and ignored again. Windows cells failed at load because that lock admitted no nokogiri platform, and moxml's adapter lookup raised inside require "lutaml/model". - The resolution specs now skip cleanly when lutaml-model cannot load: the resolver's model branch is defined?-guarded, so the parser suite stays meaningful without the integration. - nokogiri joins the test Gemfile so the model-backed specs run on every CI platform rather than only where a transitive resolver happens to pull an adapter.
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.
Instance-path resolution: the RS 3002 evaluation half
The gem parses instance data paths (RS 3002 "LutaML path for instance
data") — grammar, filters, conditions, 87 green examples — but
resolution was deliberately out of scope:
InstancePath#match?raises rather than silently matching names while ignoring conditions.
This adds the evaluation half, without touching the parser, the AST,
or a single existing example:
Lutaml::Path::ResolverwalksInstancePath#stepsover realmodel data: lutaml-model Serializable instances (attribute readers
via the class contract), plain hashes, and their collections.
Base steps anchor the root, attribute steps read named children
(segment patterns through the existing fnmatch contract),
**selects every descendant, and a step's condition filters the
candidates.
Lutaml::Path::Filter::ConditionEvaluatorevaluates theCondition AST the parser already produces: comparisons (
=,!=,>,<,>=,<=with numeric coercion when both sides arenumeric), list membership (
in), existence,&&/||/!withparentheses and nesting, and wildcard values via
File.fnmatch(..., FNM_EXTGLOB)— matching the segment matcher'sown glob semantics.
Lutaml::Path.resolve(root, path)andInstancePath#resolve(root). Plain chains resolve to a singlevalue; filters, patterns, and deep wildcards return collections.
lutaml-model (>= 0.8)joinsparslet— resolutionreads model attributes through the Serializable contract.
The new specs port RS 3002's own instance-data examples (the
contributor / organization / role / docidentifier corpus) end-to-end
against real lutaml-model instances, including hash-rooted data,
chained and nested filters, wildcards, and deep hierarchy matches.
Suite: 98 examples, 0 failures (87 existing + 11 new). Rubocop clean.