-
Notifications
You must be signed in to change notification settings - Fork 81
Description
I'm trying to understand if it is possible to perform top-down (incoming) trace checks in sphinx-needs. E.g., I have a system requirements document and I need to ensure that all (maybe filtered) needs have an outgoing trace to other items. I tried to do this in the schema.json.
E.g., I have the following extra_link
[[needs.extra_links]]
# req -> req, spec -> spec
# notice that 'directive' names == 'option' can't have multiple words ...
option = "decomposed-from"
incoming = "decomposes to"
outgoing = "decomposed from"Upstream (outgoing) can be nicely done in the schema.json, e.g., I can ensure that all software requirements (that fit my "select") have at least one outgoing (upstream) trace to system requirements:
{
"schemas": [
{
"id": "srs-decomposed-from-sys",
"severity": "violation",
"message": "Software requirements use the link type 'decomposed from' to system requirements",
"select": { "$ref": "#/$defs/item-srs" },
"validate": {
"network": {
"decomposed-from": {
"contains": { "local": { "$ref": "#/$defs/type-sys" } },
"minContains": 1
}
}
}
}
]
}However, something like the following using the "incoming" notation of the extra_links is not possible:
{
"schemas": [
{
"id": "sys-decomposes-to-srd",
"severity": "violation",
"message": "System requirements have at least one downstream link 'decomposes to' to software requirements",
"select": { "$ref": "#/$defs/item-sys" },
"validate": {
"network": {
"decomposes to": {
"contains": { "local": { "$ref": "#/$defs/type-srs" } },
"minContains": 1
}
}
}
}
]
}Using decomposed-from_back for the link type also doesn't work, so I guess I can only check upstream (outgoing) using schema.json.
- I then tried to look at
need_constraintsbut those apply globally so I didn't check those further (I need to define my trace types by item type). - Dynamic functions also don't work (and are not intended for this check) since they can't look at incoming links (#1457).
I guess this could be a separate extension where (separate) schemas can be created for incoming links (downstream checks). E.g., I could check that certain directives follow a schema downstream (incoming), but since top-down reviews are very common in safety-related projects I wanted to just quickly ask if something like this is maybe (not officially) supported or on the roadmap?
For now, I'm using needtable with the _back notation such that completeness can be verified quite easily using tables, but It would be great to have a schema definition for top-down reviews, e.g., also using more complex need types (I could imagine, e.g., adding another directive "Terminator" for items that are not supposed to have any outgoing links).