Skip to content

Fixed collections for lutaml-model strict cardinality - #27

Merged
HassanAkbar merged 3 commits into
mainfrom
feat/strict-cardinality-collections
Jul 14, 2026
Merged

Fixed collections for lutaml-model strict cardinality#27
HassanAkbar merged 3 commits into
mainfrom
feat/strict-cardinality-collections

Conversation

@HassanAkbar

@HassanAkbar HassanAkbar commented Jul 8, 2026

Copy link
Copy Markdown
Member

Metanorma PR checklist

Related to lutaml/lutaml-model#720
Fixes failures in https://github.com/lutaml/lutaml-model/actions/runs/28665689704/job/85029021256?pr=720

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Uniword’s OOXML model layer and specs to accommodate lutaml-model’s stricter cardinality handling by converting previously-scalar attributes into collections and standardizing access patterns (e.g., Run#text_string, Paragraph#style).

Changes:

  • Make Wordprocessingml::Run#text and #break collections, add #text_string, and update substitution/text-handling call sites.
  • Make Wordprocessingml::ParagraphProperties#style a collection (with StyleReference.cast) and update style consumers to use the first style reference consistently.
  • Update builders, converters, validators, and extensive specs/integration tests to use the new collection-based APIs.

Reviewed changes

Copilot reviewed 52 out of 52 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/uniword/wordprocessingml/run_spec.rb Adjust run text assertions to use collection text and text_string.
spec/uniword/wordprocessingml/paragraph_spec.rb Update paragraph style/text expectations for new APIs.
spec/uniword/wordprocessingml/paragraph_enhanced_properties_spec.rb Update style access to use first style reference in collection.
spec/uniword/wordprocessingml/numbering_spec.rb Update style access to use style.first.
spec/uniword/toc/toc_generator_spec.rb Update run text extraction to use text_string.
spec/uniword/properties/paragraph_properties_spec.rb Update paragraph properties style expectations for collection semantics.
spec/uniword/hyperlink_spec.rb Update hyperlink run text assertions for collection text.
spec/uniword/docx/reconciler_spec.rb Update paragraph style assertion to use paragraph-level accessor.
spec/uniword/document_spec.rb Update document paragraph style assertions to use Paragraph#style.
spec/uniword/builder/toc_builder_spec.rb Update TOC builder expectations to use text_string.
spec/uniword/builder/run_utils_spec.rb Update run merge expectations for text_string and break collection.
spec/uniword/builder/run_builder_spec.rb Update run builder expectations to use text_string.
spec/uniword/builder/paragraph_builder_spec.rb Update paragraph builder expectations for collection text/style.
spec/uniword/builder/header_footer_builder_spec.rb Update header/footer builder expectations to use text_string.
spec/uniword/builder/footnote_builder_spec.rb Update footnote builder expectations for text_string and break collection.
spec/uniword/builder/document_builder_spec.rb Update document builder expectations for style collection and Paragraph#style.
spec/uniword/builder/document_builder_enhanced_spec.rb Update break assertions for break collection.
spec/uniword/builder/comprehensive_scenario_spec.rb Update scenario assertions for Paragraph#style and break collection.
spec/uniword/builder/comment_builder_spec.rb Update comment builder expectations to use text_string.
spec/uniword/builder/builder_spec.rb Update builder spec expectations for text_string and break collection.
spec/uniword/assembly/variable_substitutor_spec.rb Update variable substitution spec expectations to use text_string.
spec/uniword/assembly/document_assembler_spec.rb Update assembled document assertions to use text_string.
spec/transformation/html_element_builder_spec.rb Update HTML transformation expectations to use text_string and break collection.
spec/support/helpers.rb Make helper prefer text_string, fallback to text.
spec/integration/styles_integration_spec.rb Update integration expectations for Paragraph#style returning style ref semantics.
spec/integration/mhtml_edge_cases_spec.rb Update integration expectations for Paragraph#style.
spec/integration/libreoffice_spec.rb Update integration text extraction to prefer text_string.
spec/integration/format_conversion_spec.rb Update format conversion text extraction to use text_string.
lib/uniword/wordprocessingml/run.rb Convert text/break to collections; add text_string; update substitution behavior.
lib/uniword/wordprocessingml/paragraph.rb Use Run#text_string for text extraction; return first style ref in #style.
lib/uniword/wordprocessingml/paragraph_properties.rb Make style a collection; adjust YAML mapping accordingly.
lib/uniword/watermark/manager.rb Use Paragraph#style and Run#text_string when detecting/extracting watermark text.
lib/uniword/visitor/text_extractor.rb Switch run text extraction to text_string (and skip empty).
lib/uniword/validation/checkers/internal_link_checker.rb Simplify heading detection/extraction using Paragraph#style and Paragraph#text.
lib/uniword/transformation/ooxml_to_html_converter.rb Use text_string and ensure style stringification for HTML class output.
lib/uniword/transformation/mhtml_metadata_builder.rb Use text_string for character/word counting.
lib/uniword/transformation/mhtml_element_renderer.rb Handle break as collection; use text_string; render multiple breaks.
lib/uniword/toc/toc_generator.rb Simplify style resolution and set paragraph style using string assignment.
lib/uniword/template/helpers/loop_helper.rb Perform variable substitution via Run#substitute using text_string.
lib/uniword/quality/rules/style_consistency_rule.rb Switch to Paragraph#style for style checks.
lib/uniword/quality/rules/heading_hierarchy_rule.rb Switch to Paragraph#style for heading-level extraction.
lib/uniword/properties/style_reference.rb Add StyleReference.cast to support assigning raw strings.
lib/uniword/mhtml/document.rb Type parts as a MimePart collection instead of a generic array.
lib/uniword/docx/reconciler/referential_integrity.rb Normalize paragraph style access via first style ref from collection.
lib/uniword/docx/reconciler/helpers.rb Use text_string for document fingerprint text extraction.
lib/uniword/diff/document_differ.rb Update style formatting to read first style ref from collection.
lib/uniword/builder/run_utils.rb Update break/text checks and merging to use collection semantics and text_string.
lib/uniword/builder/paragraph_builder.rb Assign style via string (relying on cast) for collection-based style.
lib/uniword/batch/stages/normalize_styles_stage.rb Avoid nil assignments; normalize style comparisons via to_s.
lib/uniword/assembly/variable_substitutor.rb Use Run#substitute_with_block to replace variables across collection text.
lib/uniword/assembly/toc.rb Use Paragraph#style and Run#text_string for TOC assembly logic.
lib/uniword/accessibility/rules/descriptive_headings_rule.rb Extract heading text via text_string from runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/uniword/wordprocessingml/run.rb
Comment thread lib/uniword/wordprocessingml/run.rb
@HassanAkbar
HassanAkbar marked this pull request as ready for review July 14, 2026 10:23
@HassanAkbar
HassanAkbar merged commit 98d0bfa into main Jul 14, 2026
14 checks passed
@HassanAkbar
HassanAkbar deleted the feat/strict-cardinality-collections branch July 14, 2026 10:24
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.

2 participants