Skip to content

feat: add XSD direct block syntax and UnitsML fixture specs - #271

Merged
ronaldtse merged 2 commits into
mainfrom
feature/xsd_direct_block_and_unitsml_specs
May 14, 2026
Merged

feat: add XSD direct block syntax and UnitsML fixture specs#271
ronaldtse merged 2 commits into
mainfrom
feature/xsd_direct_block_and_unitsml_specs

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Salvages two features from PR #251 (which was effectively empty — contributor removed their own Liquid filters):

  1. XSD direct block syntax (lutaml_xsd::path[context, template, options]) — renders XSD schemas using external Liquid template files
  2. UnitsML/OMML XSD fixture specs — comprehensive test coverage for complex real-world XSD schemas

Architecture

  • FILE_SYSTEM_PATTERNS constant and build_file_system method extracted into BasePreprocessor for reuse by both block and direct syntax paths (DRY, Open/Closed)
  • handle_direct_block reuses inherited Template Method hooks: load_lutaml_file, template, update_repo, build_file_system
  • process_text_blocks override checks for direct syntax before delegating to super — clean extension point
  • Two-tier caching (class-level + document-level) applies to both syntaxes

Spec coverage (14 examples, 0 failures)

  • Block syntax: person.xsd fragments, caching, location option, missing file, Liquid errors
  • UnitsML schema: elements, complex types, attribute groups with cross-references
  • OMML schema: elements and complex types with location option
  • Direct block syntax: external Liquid templates with {% render %} tag, missing template error, mixed direct+block syntax

Other changes

  • Enable rubygems MFA requirement in gemspec
  • Update .gitignore for transient files (test.err.html, TODO.cleanup/, pkg/)
  • Regenerate .rubocop_todo.yml

Closes #251

ronaldtse added 2 commits May 14, 2026 07:16
Add lutaml_xsd::path[context, template, options] direct block syntax
to LutamlXsdPreprocessor, enabling external Liquid template files for
XSD schema rendering.

Extract FILE_SYSTEM_PATTERNS constant and build_file_system method
into BasePreprocessor for reuse by both block and direct syntax paths.

Enable rubygems MFA requirement in gemspec.
Add comprehensive specs covering:
- UnitsML schema elements and complex types (block syntax)
- OMML schema with location option (block syntax)
- Full UnitsML documentation with cross-references (block syntax)
- XSD direct block syntax with external Liquid templates
- Mixed direct + block syntax in same document
- Missing template file error handling

Includes expected output XML fixtures for semantic comparison.
@ronaldtse
ronaldtse merged commit 9c44ade into main May 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant