Skip to content

Commit 64c5b9a

Browse files
committed
fix(backend/reqif): improve handling of documents with no relations and treat integer fields as string grammar fields
1 parent 3d73361 commit 64c5b9a

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

strictdoc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from strictdoc.core.environment import SDocRuntimeEnvironment
22

3-
__version__ = "0.14.1a1"
3+
__version__ = "0.14.1a2"
44

55

66
environment = SDocRuntimeEnvironment(__file__)

strictdoc/backend/reqif/p01_sdoc/reqif_to_sdoc_converter.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,16 @@ def convert_reqif_bundle(
8787
):
8888
return []
8989

90-
for (
91-
spec_relation_
92-
) in reqif_bundle.core_content.req_if_content.spec_relations:
93-
spec_relation_type_ = reqif_bundle.lookup.get_spec_type_by_ref(
94-
spec_relation_.relation_type_ref
95-
)
96-
context.map_source_target_pairs_to_spec_relation_types[
97-
(spec_relation_.source, spec_relation_.target)
98-
] = spec_relation_type_
90+
if reqif_bundle.core_content.req_if_content.spec_relations is not None:
91+
for (
92+
spec_relation_
93+
) in reqif_bundle.core_content.req_if_content.spec_relations:
94+
spec_relation_type_ = reqif_bundle.lookup.get_spec_type_by_ref(
95+
spec_relation_.relation_type_ref
96+
)
97+
context.map_source_target_pairs_to_spec_relation_types[
98+
(spec_relation_.source, spec_relation_.target)
99+
] = spec_relation_type_
99100

100101
documents: List[SDocDocument] = []
101102
for (
@@ -282,6 +283,15 @@ def create_grammar_element_from_spec_object_type(
282283
required="False",
283284
)
284285
)
286+
elif attribute.attribute_type == SpecObjectAttributeType.INTEGER:
287+
fields.append(
288+
GrammarElementFieldString(
289+
parent=None,
290+
title=sdoc_safe_field_name,
291+
human_title=sdoc_field_human_title,
292+
required="False",
293+
)
294+
)
285295
elif attribute.attribute_type == SpecObjectAttributeType.XHTML:
286296
fields.append(
287297
GrammarElementFieldString(
@@ -338,7 +348,7 @@ def create_grammar_element_from_spec_object_type(
338348
pass
339349
else:
340350
raise NotImplementedError( # pragma: no cover
341-
attribute
351+
attribute.attribute_type, attribute
342352
) from None
343353

344354
requirement_element = GrammarElement(

0 commit comments

Comments
 (0)