Skip to content

fix: unparse a SPEC-OBJECT that has no VALUES element - #237

Merged
stanislaw merged 1 commit into
strictdoc-project:mainfrom
Eliot5566:fix/unparse-spec-object-without-values
Nov 15, 2026
Merged

stanislaw merged 1 commit into
strictdoc-project:mainfrom
Eliot5566:fix/unparse-spec-object-without-values

Conversation

@Eliot5566

Copy link
Copy Markdown
Contributor

Refs #233.

The parsing side of #233 already works on main: reqif validate --use-reqif-schema accepts the document from the issue, and test_03_missing_values_element covers it. Writing the same document back still fails. reqif passthrough on it stops with an AssertionError in SpecObjectParser.unparse, which asserted that the parsed SPEC-OBJECT node had a VALUES child.

This drops that assertion. A SPEC-OBJECT without VALUES is written back without it, so passthrough reproduces the input. If attributes were added to such an object after parsing, VALUES is written before TYPE, so they are not lost.

Tests:

  • tests/integration/reqif/SPEC-OBJECTS/02_spec_object_without_values: passthrough of one SPEC-OBJECT with no VALUES and one with <VALUES/>, diffed against the input. It fails on main.
  • Two unit tests in test_spec_object_parser.py, one for the plain case and one for an attribute added after parsing. Both fail on main.

invoke test-equivalent runs locally: 78 unit tests pass, and the integration suite has 78 passed and 2 failed. The same 2 (commands/dump/01_basic_example and examples/04_convert_reqif_to_json) fail on main in my environment too. ruff check and ruff format are clean, and mypy reports the same 10 errors as main.

I left the issue open with "Refs" because I'm not sure whether you consider #233 covered by the parsing change.

I used Claude to help write and test this change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hq1ACTsK85bRrY28fUQ7b3

VALUES is optional on SPEC-OBJECT and the parser accepts its absence,
but SpecObjectParser.unparse asserted that the parsed node had one, so
'reqif passthrough' failed with an AssertionError on such a document.
The assertion is gone; VALUES is still written when the object has
attributes, for example ones added after parsing.

Refs strictdoc-project#233

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hq1ACTsK85bRrY28fUQ7b3
@stanislaw
stanislaw merged commit f5c4646 into strictdoc-project:main Nov 15, 2026
6 checks passed
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