Skip to content

Commit 3ac0a51

Browse files
authored
Merge pull request #153 from strictdoc-project/stanislaw/examples
tests/integration: demonstrate --use-reqif-schema against random ChatGPT ReqIF
2 parents b6c73fe + 3b9359a commit 3ac0a51

4 files changed

Lines changed: 104 additions & 1 deletion

File tree

reqif/cli/cli_arg_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def formatter(prog):
8585
command_parser_validate.add_argument(
8686
"--use-reqif-schema",
8787
action="store_true",
88-
help="Enable ReqIF schema validation.",
88+
help="Enable a strict ReqIF schema validation.",
8989
)
9090

9191
# Command – Version

reqif/commands/validate/validate.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ def execute(cls, config: ValidateCommandConfig):
6565
f"{len(error_bundle.schema_errors)} schema issues found, "
6666
f"{len(error_bundle.semantic_warnings)} semantic issues found."
6767
)
68+
if not config.use_reqif_schema:
69+
print( # noqa: T201
70+
"NOTE: By default, the validation does not perform a strict "
71+
"check of the ReqIF schema conformance. "
72+
"To enable the strict conformance check, "
73+
"rerun the validation with --use-reqif-schema."
74+
)
6875
exit_code = 0 if not error_bundle.has_any_errors() else 1
6976
sys.exit(exit_code)
7077

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<REQ-IF xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd" xsi:schemaLocation="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd reqif.xsd">
4+
<THE-HEADER>
5+
<REQ-IF-HEADER IDENTIFIER="ReqIF-Header" REQ-IF-TOOL-ID="OpenAI GPT-3.5" SOURCE-TOOL-ID="YourToolName" CREATION-TIME="2023-07-07T00:00:00Z" TITLE="Coffee Machine System-Level Requirements" COMMENT="System-level requirements for a coffee machine."/>
6+
</THE-HEADER>
7+
<CORE-CONTENT>
8+
<SPECIFICATIONS>
9+
<SPEC-OBJECT-TYPE IDENTIFIER="reqif.standard.requirement" LONG-NAME="Requirement">
10+
<SPEC-ATTRIBUTES>
11+
<ATTRIBUTE-DEFINITION-STRING IDENTIFIER="reqif.standard.requirement.description" LONG-NAME="Description" TYPE="HTML"/>
12+
<ATTRIBUTE-DEFINITION-ENUMERATION IDENTIFIER="reqif.standard.requirement.status" LONG-NAME="Status">
13+
<VALUES>
14+
<ENUM-VALUE IDENTIFIER="reqif.standard.requirement.status.open" LONG-NAME="Open"/>
15+
<ENUM-VALUE IDENTIFIER="reqif.standard.requirement.status.inprogress" LONG-NAME="In Progress"/>
16+
<ENUM-VALUE IDENTIFIER="reqif.standard.requirement.status.completed" LONG-NAME="Completed"/>
17+
</VALUES>
18+
</ATTRIBUTE-DEFINITION-ENUMERATION>
19+
</SPEC-ATTRIBUTES>
20+
</SPEC-OBJECT-TYPE>
21+
<SPECIFICATION IDENTIFIER="reqif.specification.systemlevel" LONG-NAME="System-Level Requirements">
22+
<TYPE>reqif.standard.requirement</TYPE>
23+
<VALUES>
24+
<SPEC-OBJECT IDENTIFIER="RQ1" LAST-CHANGE="2023-07-07T00:00:00Z">
25+
<VALUES>
26+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should support multiple brewing options, such as espresso, cappuccino, and latte." DEFINITION="reqif.standard.requirement.description"/>
27+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
28+
</VALUES>
29+
</SPEC-OBJECT>
30+
<SPEC-OBJECT IDENTIFIER="RQ2" LAST-CHANGE="2023-07-07T00:00:00Z">
31+
<VALUES>
32+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should have a water reservoir with a capacity of at least 1 liter." DEFINITION="reqif.standard.requirement.description"/>
33+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
34+
</VALUES>
35+
</SPEC-OBJECT>
36+
<SPEC-OBJECT IDENTIFIER="RQ3" LAST-CHANGE="2023-07-07T00:00:00Z">
37+
<VALUES>
38+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should allow users to adjust the grinding settings for different coffee beans." DEFINITION="reqif.standard.requirement.description"/>
39+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
40+
</VALUES>
41+
</SPEC-OBJECT>
42+
<SPEC-OBJECT IDENTIFIER="RQ4" LAST-CHANGE="2023-07-07T00:00:00Z">
43+
<VALUES>
44+
<ATTRIBUTE-VALUE-STRING THE-VALUE="Users should be able to select the desired brew strength, such as strong or mild." DEFINITION="reqif.standard.requirement.description"/>
45+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
46+
</VALUES>
47+
</SPEC-OBJECT>
48+
<SPEC-OBJECT IDENTIFIER="RQ5" LAST-CHANGE="2023-07-07T00:00:00Z">
49+
<VALUES>
50+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should have a milk frothing functionality to prepare beverages that require frothed milk." DEFINITION="reqif.standard.requirement.description"/>
51+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
52+
</VALUES>
53+
</SPEC-OBJECT>
54+
<SPEC-OBJECT IDENTIFIER="RQ6" LAST-CHANGE="2023-07-07T00:00:00Z">
55+
<VALUES>
56+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should have an intuitive user interface with easy-to-use controls and a display for status and settings." DEFINITION="reqif.standard.requirement.description"/>
57+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
58+
</VALUES>
59+
</SPEC-OBJECT>
60+
<SPEC-OBJECT IDENTIFIER="RQ7" LAST-CHANGE="2023-07-07T00:00:00Z">
61+
<VALUES>
62+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should have features to facilitate easy cleaning and maintenance, such as removable parts and self-cleaning functionality." DEFINITION="reqif.standard.requirement.description"/>
63+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
64+
</VALUES>
65+
</SPEC-OBJECT>
66+
<SPEC-OBJECT IDENTIFIER="RQ8" LAST-CHANGE="2023-07-07T00:00:00Z">
67+
<VALUES>
68+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should have a power-saving mode that automatically turns off the machine after a period of inactivity." DEFINITION="reqif.standard.requirement.description"/>
69+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
70+
</VALUES>
71+
</SPEC-OBJECT>
72+
<SPEC-OBJECT IDENTIFIER="RQ9" LAST-CHANGE="2023-07-07T00:00:00Z">
73+
<VALUES>
74+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should be compatible with standard coffee capsules or pods available in the market." DEFINITION="reqif.standard.requirement.description"/>
75+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
76+
</VALUES>
77+
</SPEC-OBJECT>
78+
<SPEC-OBJECT IDENTIFIER="RQ10" LAST-CHANGE="2023-07-07T00:00:00Z">
79+
<VALUES>
80+
<ATTRIBUTE-VALUE-STRING THE-VALUE="The coffee machine should provide informative error messages and handle exceptions gracefully." DEFINITION="reqif.standard.requirement.description"/>
81+
<ATTRIBUTE-VALUE-ENUMERATION THE-VALUE="reqif.standard.requirement.status.open" DEFINITION="reqif.standard.requirement.status"/>
82+
</VALUES>
83+
</SPEC-OBJECT>
84+
</VALUES>
85+
</SPECIFICATION>
86+
</SPECIFICATIONS>
87+
</CORE-CONTENT>
88+
</REQ-IF>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
RUN: %expect_exit 0 %reqif validate %S/sample.reqif | filecheck %s --dump-input=fail --check-prefix=CHECK-NOSTRICT
2+
3+
CHECK-NOSTRICT: Validation complete with 0 errors, 0 schema issues found, 0 semantic issues found.
4+
5+
RUN: %expect_exit 1 %reqif validate --use-reqif-schema %S/sample.reqif | filecheck %s --dump-input=fail --check-prefix=CHECK-STRICT
6+
7+
CHECK-STRICT: Reason: 'REQ-IF-TOOL-ID' attribute not allowed for element
8+
CHECK-STRICT: Validation complete with 0 errors, 1 schema issues found, 0 semantic issues found.

0 commit comments

Comments
 (0)