feat: lutaml_xsd command support - #246
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR incorporates the lutaml_xsd command to support processing XSD (XML Schema Definition) files using Liquid templates. The feature allows users to extract and render schema elements, complex types, and other XSD components through template-based documentation generation.
Key Changes
- Adds LutaML XSD preprocessor functionality for processing XML Schema files
- Implements base preprocessor class to share common functionality between preprocessors
- Includes comprehensive test coverage for XSD processing with UnitsML and OMML schemas
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
lib/metanorma/plugin/lutaml/lutaml_xsd_preprocessor.rb |
New preprocessor class implementing XSD-specific processing logic |
lib/metanorma/plugin/lutaml/base_preprocessor.rb |
Base class extracted from existing preprocessor to share common functionality |
lib/metanorma/plugin/lutaml/lutaml_preprocessor.rb |
Refactored to inherit from BasePreprocessor |
spec/metanorma/plugin/lutaml/lutaml_xsd_preprocessor_spec.rb |
Comprehensive test suite for XSD preprocessor functionality |
spec/fixtures/lutaml/xsd_schemas/unitsml-v1.0-csd04.xsd |
Test fixture: UnitsML XSD schema for testing |
spec/fixtures/lutaml/xsd_schemas/omml.xsd |
Test fixture: OMML XSD schema for testing |
docs/usages/lutaml-xsd.adoc |
Documentation for the new lutaml_xsd command usage |
| yaml = Zlib::Inflate.inflate(yaml_compressed) | ||
| cache = Expressir::Model::Cache.from_yaml(yaml) | ||
| cache.version = "2.1.22" | ||
| cache.version = "2.1.23" |
There was a problem hiding this comment.
[nitpick] The hardcoded version string "2.1.23" appears to be test-specific and may become outdated. Consider using a constant or making this version configurable to avoid maintenance issues when the actual version changes.
| cache.version = "2.1.23" | |
| cache.version = CACHE_VERSION |
ab3e7b5 to
238117d
Compare
8972c92 to
2e0df96
Compare
2e0df96 to
5c01435
Compare
|
@suleman-uzair @HassanAkbar @ronaldtse What is the status of this PR? |
@opoudjis, we’ve made some required upstream changes in |
cd2dcd9 to
cb8bdc9
Compare
Move shared preprocessor logic (block parsing, Liquid rendering, index lookup) into BasePreprocessor. LutamlPreprocessor now only implements format-specific hooks: load_lutaml_file dispatches to Express::Parsers::Exp or Uml::Parsers::Dsl, update_repo handles ExpFile/Repository unwrapping and remark decoration, template uses the custom Liquid environment with keyiterator tag and filters.
Lutaml::Parser was removed in lutaml 0.10. Replace all call sites: - Lutaml::Express::Parsers::Exp.parse_cache for cache loading - Expressir::Express::Parser.from_files for multi-file EXPRESS loading
New LutamlXsdPreprocessor < BasePreprocessor handles [lutaml_xsd] blocks. Parses XSD files via lutaml-model, renders with Liquid, and caches parse results in both a class variable and per-document attributes to avoid re-parsing the same file across blocks or documents.
…paths - find_packaged_klass_by_path now iterates all candidates instead of returning the first match by name, correctly disambiguating classes with the same name in different packages. - find_packaged_klass strips the root model name prefix from absolute paths (e.g. ::EA_Model::...) so match_parent_chain? walks the actual parent chain without hitting a missing root entry. - Extract match_parent_chain? helper for clarity.
7a835db to
b77c3a8
Compare
Test now uses File.basename(Dir.pwd) instead of hardcoded directory name, making it work in any checkout location. Update Gemfile and Gemfile.lock for lutaml-model 0.8.7.
b77c3a8 to
bf5bc38
Compare
Metanorma PR checklist
This PR incorporates the
lutaml_xsdcommand, allowing access to the XSD schema's processing.closes #176