Skip to content

Commit 233ce30

Browse files
authored
Merge pull request #351 from bci-oss/bugfix/ESMF-313-characteristic-trait-is-not-displayed
Fix #313 Trait Base Characteristic not included in HTML Documentation
2 parents 3f93150 + 8697461 commit 233ce30

File tree

5 files changed

+43
-12
lines changed

5 files changed

+43
-12
lines changed

core/esmf-aspect-model-document-generators/src/main/resources/docu/templates/html/characteristic-documentation-lib.vm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
#list( $characteristic.getSee() )
2323
</div>
2424
</div>
25+
#elseif($characteristic.getBaseCharacteristic())
26+
<div class="table-row-group">
27+
<div class="table-cell pb-3 col-span-2">
28+
$i18n.getText( "docu.label.see" )
29+
#list( $characteristic.getBaseCharacteristic().getSee() )
30+
</div>
31+
</div>
2532
#end
2633
#if( $characteristic.getDataType().isPresent() && !$characteristicClass.equals( "Either" ) )
2734
<div class="table-row-group">

core/esmf-aspect-model-document-generators/src/main/resources/docu/templates/html/property-documentation-lib.vm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@
8181
#if( !$property.getSee().isEmpty() )
8282
<div class="flex border-b pb-1 py-4">
8383
<div class="w-80">$i18n.getText( "docu.label.see" )</div>
84-
#list( $property.getSee() )
84+
<div class="w-full">
85+
#foreach($item in $property.getSee())
86+
<ul class="reset-all-styles m-0 list">
87+
<li>$item</li>
88+
</ul>
89+
#end
90+
</div>
8591
</div>
8692
#end
8793

core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/docu/AspectModelDocumentationGeneratorTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ public void testAspectWithQuantifiableWithoutUnit( final KnownVersion metaModelV
194194
}
195195
}
196196

197+
@ParameterizedTest
198+
@MethodSource( "allVersions" )
199+
public void testAspectWithConstraintWithSeeAttribute( final KnownVersion metaModelVersion ) throws IOException {
200+
final String documentation = generateHtmlDocumentation( TestAspect.ASPECT_WITH_CONSTRAINT_WITH_SEE_ATTRIBUTE, metaModelVersion );
201+
assertThat( documentation ).contains(
202+
"<h3 id=\"org-eclipse-esmf-test-AspectWithConstraintWithSeeAttribute-org-eclipse-esmf-test-testPropertyTwo-property\">testPropertyTwo</h3>" );
203+
assertThat( documentation ).contains(
204+
"<div class=\"table-cell pb-3 col-span-2\">Trait</div>" );
205+
assertThat( documentation ).contains(
206+
"<li>http://example.com/me2</li>" );
207+
}
208+
197209
private String generateHtmlDocumentation( final TestAspect model, final KnownVersion testedVersion ) throws IOException {
198210
final VersionedModel versionedModel = TestResources.getModel( model, testedVersion ).get();
199211
final Aspect aspect = AspectModelLoader.getSingleAspect( versionedModel ).getOrElseThrow( () -> new RuntimeException() );

core/esmf-test-aspect-models/src/main/resources/valid/samm_1_0_0/org.eclipse.esmf.test/1.0.0/AspectWithConstraintWithSeeAttribute.ttl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@
4343
:TestTraitTwo a samm-c:Trait ;
4444
samm:name "TestTraitTwo" ;
4545
samm-c:constraint [
46-
a samm-c:LengthConstraint ;
47-
samm:name "TestConstraintTwo" ;
46+
a samm-c:RegularExpressionConstraint ;
4847
samm:preferredName "Test Constraint Two"@en ;
4948
samm:description "Test Constraint Two"@en ;
50-
samm:see <http://example.com/> ;
5149
samm:see <http://example.com/me> ;
52-
samm-c:minValue "5"^^xsd:nonNegativeInteger ;
53-
samm-c:maxValue "10"^^xsd:nonNegativeInteger ;
50+
samm:value "^[A-Z][A-Z][A-Z]$" ;
5451
] ;
55-
samm-c:baseCharacteristic samm-c:Text .
52+
samm-c:baseCharacteristic :TestCharacteristicTwo .
53+
:TestCharacteristicTwo a samm:Characteristic;
54+
samm:preferredName "Test Characteristic Two"@en;
55+
samm:description "Test Characteristic Two"@en;
56+
samm:dataType xsd:string;
57+
samm:see <http://example.com/me2> .

core/esmf-test-aspect-models/src/main/resources/valid/samm_2_0_0/org.eclipse.esmf.test/1.0.0/AspectWithConstraintWithSeeAttribute.ttl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@
3737

3838
:TestTraitTwo a samm-c:Trait ;
3939
samm-c:constraint [
40-
a samm-c:LengthConstraint ;
40+
a samm-c:RegularExpressionConstraint ;
4141
samm:preferredName "Test Constraint Two"@en ;
4242
samm:description "Test Constraint Two"@en ;
43-
samm:see <http://example.com/> ;
44-
samm-c:minValue "5"^^xsd:nonNegativeInteger ;
45-
samm-c:maxValue "10"^^xsd:nonNegativeInteger ;
43+
samm:see <http://example.com/me> ;
44+
samm:value "^[A-Z][A-Z][A-Z]$" ;
4645
] ;
47-
samm-c:baseCharacteristic samm-c:Text .
46+
samm-c:baseCharacteristic :TestCharacteristicTwo .
47+
:TestCharacteristicTwo a samm:Characteristic;
48+
samm:preferredName "Test Characteristic Two"@en;
49+
samm:description "Test Characteristic Two"@en;
50+
samm:dataType xsd:string;
51+
samm:see <http://example.com/me2> .

0 commit comments

Comments
 (0)