Custom liquid drop methods - #26
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the Liquid template integration by adding new liquid drop methods and comprehensive test coverage across XSD components. It also migrates from the xml-c14n gem to canon for XML canonicalization.
Key changes include:
- Added sorting methods for schema elements, complex types, and attribute groups
- Enhanced Base class with type checking predicates and cardinality methods
- Added
direct_child_elements,base_type, andreferenced_objectmethods across various components - Created comprehensive test suites for all liquid method modules
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lutaml-xsd.gemspec | Added canon gem as runtime dependency (version 0.1.3) |
| Gemfile | Removed canon and xml-c14n from development dependencies (now in gemspec) |
| spec/spec_helper.rb | Updated to use canon gem instead of xml-c14n for XML formatting |
| spec/lutaml/xsd_spec.rb | Refactored regex constants into reusable SCHEMA_ELEMENTS_REGEXES constant |
| lib/lutaml/xsd/base.rb | Added type checking methods, cardinality methods, and safe navigation to resolved_element_order |
| lib/lutaml/xsd/schema.rb | Added liquid methods for sorted access to elements, complex types, and attribute groups |
| lib/lutaml/xsd/simple_content.rb | Added base_type liquid mapping |
| lib/lutaml/xsd/complex_type.rb | Added direct_child_elements liquid mapping |
| lib/lutaml/xsd/liquid_methods/schema.rb | New file implementing sorting methods for schema collections |
| lib/lutaml/xsd/liquid_methods/simple_content.rb | Added base_type method to retrieve base from various sources |
| lib/lutaml/xsd/liquid_methods/sequence.rb | Changed Xsd::Element to Element (introduces bug) |
| lib/lutaml/xsd/liquid_methods/group.rb | Added referenced_object method and fixed child_elements to use referenced group |
| lib/lutaml/xsd/liquid_methods/element.rb | Removed min_occurrences and max_occurrences (moved to Base), added safe navigation for attributes/child_elements |
| lib/lutaml/xsd/liquid_methods/complex_type.rb | Added direct_child_elements method, changed flat_map to each for attribute accumulation |
| lib/lutaml/xsd/liquid_methods/attribute_group.rb | Fixed referenced_object logic and added safe navigation to find_used_by |
| README.adoc | Comprehensive documentation updates for new methods and reorganized Base class methods section |
| spec/lutaml/xsd/liquid_methods/*.rb | Added 8 new comprehensive test files covering all liquid method modules |
| .rubocop_todo.yml | Updated generated timestamp and BlockLength max from 30 to 108 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
We need to move this content to lutaml-model since XSD parsing functionality has moved there. |
@ronaldtse, I’ve moved this functionality to lutaml/lutaml-model#626. I’ll let you know once it’s finalized. |
|
Thanks @suleman-uzair ! |
lutaml/lutaml-model#626 is merged now, closing this. Thanks @suleman-uzair ! |
This PR updates existing liquid drop methods, and documentation.
related to metanorma/metanorma-plugin-lutaml#251