Skip to content

fix: handle SPEC-ATTRIBUTES on RELATION-GROUP-TYPE and DEFAULT-VALUE …#214

Merged
stanislaw merged 2 commits into
strictdoc-project:mainfrom
fNBU:fix/relation-group-type-and-specification-type-unparse
May 7, 2026
Merged

fix: handle SPEC-ATTRIBUTES on RELATION-GROUP-TYPE and DEFAULT-VALUE …#214
stanislaw merged 2 commits into
strictdoc-project:mainfrom
fNBU:fix/relation-group-type-and-specification-type-unparse

Conversation

@fNBU
Copy link
Copy Markdown
Contributor

@fNBU fNBU commented May 5, 2026

…on SPECIFICATION-TYPE attributes

Bug A: ReqIFRelationGroupType had no attribute_definitions field, so any
SPEC-ATTRIBUTES children of RELATION-GROUP-TYPE were silently dropped on
parse and never emitted on unparse. Add the field and wire
AttributeDefinitionParser into both directions, matching the existing
pattern in SpecRelationTypeParser.

Bug B: SpecificationTypeParser.unparse had its own attribute-serialization
loop that omitted DEFAULT-VALUE. Delegate to
AttributeDefinitionParser.unparse_xhtml_attribute_definition (which
already handles DEFAULT-VALUE correctly), as SpecObjectTypeParser and
SpecRelationTypeParser already do.

Add unit tests and integration fixtures covering both cases.

fNBU added 2 commits May 5, 2026 16:31
…on SPECIFICATION-TYPE attributes

  Bug A: ReqIFRelationGroupType had no attribute_definitions field, so any
  SPEC-ATTRIBUTES children of RELATION-GROUP-TYPE were silently dropped on
  parse and never emitted on unparse. Add the field and wire
  AttributeDefinitionParser into both directions, matching the existing
  pattern in SpecRelationTypeParser.

  Bug B: SpecificationTypeParser.unparse had its own attribute-serialization
  loop that omitted DEFAULT-VALUE. Delegate to
  AttributeDefinitionParser.unparse_xhtml_attribute_definition (which
  already handles DEFAULT-VALUE correctly), as SpecObjectTypeParser and
  SpecRelationTypeParser already do.

  Add unit tests and integration fixtures covering both cases.
@stanislaw stanislaw merged commit cd6c4ad into strictdoc-project:main May 7, 2026
9 checks passed
fNBU added a commit to fNBU/reqif that referenced this pull request May 7, 2026
Bug C: when a SPEC-RELATION-TYPE / RELATION-GROUP-TYPE / SPECIFICATION-TYPE
is parsed from a self-closed source tag (or constructed with
is_self_closed=True) and then mutated to add attribute_definitions, the
unparse path's `if is_self_closed: return output + '/>\n'` short-circuit
fires before the SPEC-ATTRIBUTES block is emitted. Any attribute_definitions
on the IR object are silently dropped.

Fix: gate the self-closed shortcut on the absence of attributes. When
the IR has attributes to emit, force the open form regardless of how the
original source was shaped.

Symmetric to PR strictdoc-project#214's parse-side fix; the unparse-side shortcut was not
addressed there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants