From b0abd2cd60862160b9a3e2db6b5349f16b855e20 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Wed, 7 Oct 2026 08:17:15 +0800 Subject: [PATCH] Complete the modifier expansion; bump lychee-action past the injection advisory - the `abstract` prefix specializer now expands to the canonical `abstract true` declaration at the class level (the modifier capture is not a block member, so the member hook never saw it) - spec locks the data_type in-block visibility (already working via the shared enum_inner_definition list) - link-check pins lycheeverse/lychee-action@v2 (>= 2.0.2), closing the open Dependabot moderate (composite-action code injection) --- .github/workflows/link-check.yml | 2 +- lib/lutaml/lml/document_builder.rb | 14 +++++++++++--- spec/lutaml/lml/element_visibility_spec.rb | 11 +++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml index 7acea1f..bdeb6f3 100644 --- a/.github/workflows/link-check.yml +++ b/.github/workflows/link-check.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 - name: Link Checker - uses: lycheeverse/lychee-action@v1 + uses: lycheeverse/lychee-action@v2 with: args: --config lychee.toml --verbose --no-progress 'docs/**/*.adoc' 'docs/**/*.md' 'README.adoc' fail: false \ No newline at end of file diff --git a/lib/lutaml/lml/document_builder.rb b/lib/lutaml/lml/document_builder.rb index 5bee90c..b325613 100644 --- a/lib/lutaml/lml/document_builder.rb +++ b/lib/lutaml/lml/document_builder.rb @@ -72,6 +72,16 @@ def build(key, hash) def set_model(model, hash) hash = build_members(model, hash) set_model_attributes(model, hash) + expand_class_specializer(model, hash) + end + + # The prefix specializer (`abstract class Foo`) expands to the + # canonical `abstract true` declaration (RS 3001 par. Declaration + # modifiers); the class-level modifier capture is not a block member. + def expand_class_specializer(model, hash) + return unless hash[:modifier].to_s == 'abstract' && model.class.attributes.key?(:is_abstract) + + model.is_abstract = true end def set_model_attributes(model, hash) @@ -293,9 +303,7 @@ def normalize_operation_param(param) # generic attribute path). def expand_abstract_declaration(model, hash) value = hash.delete(:abstract) - return unless value && model.class.attributes.key?(:is_abstract) - - model.is_abstract = value.to_s == 'true' + model.is_abstract = true if value.to_s == 'true' && model.class.attributes.key?(:is_abstract) end def expand_definition_text(model, hash) diff --git a/spec/lutaml/lml/element_visibility_spec.rb b/spec/lutaml/lml/element_visibility_spec.rb index 50dce0d..c2f6597 100644 --- a/spec/lutaml/lml/element_visibility_spec.rb +++ b/spec/lutaml/lml/element_visibility_spec.rb @@ -71,6 +71,17 @@ class Leaf { abstract false } doc = parse("enum Finish {\n visibility protected\n matte\n}\n") expect(doc.enums.first.visibility).to eq('protected') end + + it 'applies to data_type bodies' do + doc = parse("data_type MyString {\n visibility private\n}\n") + expect(doc.data_types.first.visibility).to eq('private') + end + + it 'expands the abstract prefix to the canonical declaration' do + doc = parse("abstract class Base { }\n") + expect(doc.classes.first.is_abstract).to be(true) + expect(doc.classes.first.modifier).to eq('abstract') + end end describe 'package visibility' do