@@ -86,7 +86,7 @@ class ResultsSpecification(TypedDict):
86
86
total_checks_pass : int
87
87
total_checks_fail : int
88
88
percent_checks_pass : ResultsPercent
89
- required : bool
89
+ cardinality : str
90
90
applicability : list [str ]
91
91
requirements : list [ResultsRequirement ]
92
92
@@ -356,6 +356,13 @@ def report_specification(self, specification: Specification) -> ResultsSpecifica
356
356
)
357
357
percent_checks_pass = math .floor ((total_checks_pass / total_checks ) * 100 ) if total_checks else "N/A"
358
358
359
+ if specification .minOccurs == 1 and specification .maxOccurs == "unbounded" :
360
+ cardinality = "required"
361
+ elif specification .minOccurs == 0 and specification .maxOccurs == "unbounded" :
362
+ cardinality = "optional"
363
+ elif specification .minOccurs == 0 and specification .maxOccurs == 0 :
364
+ cardinality = "prohibited"
365
+
359
366
return ResultsSpecification (
360
367
name = specification .name ,
361
368
description = specification .description ,
@@ -370,7 +377,7 @@ def report_specification(self, specification: Specification) -> ResultsSpecifica
370
377
total_checks_pass = total_checks_pass ,
371
378
total_checks_fail = total_checks - total_checks_pass ,
372
379
percent_checks_pass = percent_checks_pass ,
373
- required = specification . minOccurs != 0 ,
380
+ cardinality = cardinality ,
374
381
applicability = applicability ,
375
382
requirements = requirements ,
376
383
)
@@ -435,6 +442,12 @@ def __init__(self, ids: Ids):
435
442
def report (self ) -> None :
436
443
super ().report ()
437
444
for spec in self .results ["specifications" ]:
445
+ print ('checking' , spec ["cardinality" ])
446
+ if spec ["cardinality" ] == "optional" and spec ["total_checks" ] == 0 :
447
+ spec ["is_skipped" ] = True
448
+ spec ["is_prohibited" ] = spec ["cardinality" ] == "prohibited"
449
+ spec ["cardinality" ] = spec ["cardinality" ].capitalize ()
450
+ spec ["has_requirements" ] = bool (spec ["requirements" ])
438
451
for requirement in spec ["requirements" ]:
439
452
total_passed_entities = len (requirement ["passed_entities" ])
440
453
total_failed_entities = len (requirement ["failed_entities" ])
0 commit comments