Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 11 additions & 3 deletions lib/lutaml/lml/document_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions spec/lutaml/lml/element_visibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading