Closed opoudjis closed 1 month ago
it continues:
Conformance test /conf/series-regular/duration does not belong to its parent class
Meaning it is IMPOSSIBLE to serialise YAML containing a conformance test in isolation from any conformance class. Serialisation triggers validation in lutaml-model, and validation crashes, because of the presumptuous assumption from modspec-ruby that only tests with parent classes can be serialised. (Not validated: even just serialised.) And there is no functionality to make validation optional.
@ronaldtse @HassanAkbar I need validation in lutaml-model to be made optional on serialisation (.to_xml(valid: false)
). Until that happens, I will not proceed further with integrating modspec-ruby into mn-requirements.
Has been resolved.
This is example 4 from the readme of this gem:
This crashes, because:
The code is forcing validation on serialisation. I think that is premature, especially as I will be doing postprocessing on the outputs of modspec-ruby.
More importantly, this code is naively assuming that it is being invoked within a suite, that a test must always have a parent class:
That may work with standalone YAML files. But if I am calling Modspec::ConformanceTest.new(), as in the readme example, I am not invoking it with a parent class. The assumption that I am invoking it with a parent class, and that :corresponding_requirements exists, is wrong.
If I am calling Modspec::ConformanceTest.new() to render a test within Metanorma, in a completely separate clause from its target, then modspec-ruby does not get to crash, just because I haven't gone out and fetched the target of the clause from the separate clause, in order to serialise them together. I should not be forced to do validation on serialising individual requirements in isolation.
If I'm going to validate requirements incorporated into a Metanorma document using modspec-ruby, I am going to assemble the Modspec requirements at the end of processing, generate the needed links, and validate them as a suite, to ensure the linkages are in place. Until I do, validation is wasting time: I should be able to disable it.
For now, I am going to make the test be
corresponding_requirements&.empty?
, to make it safe; but I may ask the validation to be optional.