fix: handle SPEC-ATTRIBUTES on RELATION-GROUP-TYPE and DEFAULT-VALUE …#214
Merged
stanislaw merged 2 commits intoMay 7, 2026
Conversation
…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
approved these changes
May 7, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.