Skip to content

Commit

Permalink
Merge pull request #746 from tschmidtb51/branches-recursion-depth
Browse files Browse the repository at this point in the history
Branches recursion depth
  • Loading branch information
santosomar committed Jun 11, 2024
2 parents a4f547e + c3ad46a commit eea00eb
Show file tree
Hide file tree
Showing 7 changed files with 946 additions and 1 deletion.
8 changes: 8 additions & 0 deletions csaf_2.1/prose/edit/src/additional-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,12 @@ The use of GitHub-flavoured Markdown is permitted in the following fields:

Other fields MUST NOT contain Markdown.

## Branch recursion

The `/product_tree` uses a nested structure for `branches`. Along a single path to a leaf, the recursion of `branches` is limited to 30 repetitions. Therefore, the longest path to a leaf is:

```
/product_tree/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/branches[]/product
```

-------
209 changes: 209 additions & 0 deletions csaf_2.1/prose/edit/src/tests-01-mndtr-34-branches-recursion-depth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
### Branches Recursion Depth{#mandatory-tests--branches-recursion-depth}

For each product defined under `/product_tree/branches[]` it MUST be tested that the complete JSON path
does not contain more than 30 instances of `branches`.

The relevant path for this test is:

```
/product_tree/branches[](/branches[])*/product
```

*Example 1 (which fails the test):*

```
"product_tree": {
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"branches": [
{
"category": "product_name",
"name": "branches",
"product": {
"name": "<<generate Product name>>",
"product_id": "CSAFPID-9080700"
}
}
],
"category": "product_family",
"name": "31"
}
],
"category": "product_family",
"name": "with"
}
],
"category": "product_family",
"name": "test"
}
],
"category": "product_family",
"name": "the"
}
],
"category": "product_family",
"name": "fail"
}
],
"category": "product_family",
"name": "and"
}
],
"category": "product_family",
"name": "limits"
}
],
"category": "product_family",
"name": "the"
}
],
"category": "product_family",
"name": "testing"
}
],
"category": "product_family",
"name": "are"
}
],
"category": "product_family",
"name": "they"
}
],
"category": "product_family",
"name": "but"
}
],
"category": "product_family",
"name": "unrealistic"
}
],
"category": "product_family",
"name": "less"
}
],
"category": "product_family",
"name": "or"
}
],
"category": "product_family",
"name": "more"
}
],
"category": "product_family",
"name": "and"
}
],
"category": "product_family",
"name": "unnecessary"
}
],
"category": "product_family",
"name": "seem"
}
],
"category": "product_family",
"name": "which"
}
],
"category": "product_family",
"name": "product"
}
],
"category": "product_family",
"name": "hypothetical"
}
],
"category": "product_family",
"name": "this"
}
],
"category": "product_family",
"name": "for"
}
],
"category": "product_family",
"name": "structure"
}
],
"category": "product_family",
"name": "nested"
}
],
"category": "product_family",
"name": "deeply"
}
],
"category": "product_family",
"name": "a"
}
],
"category": "product_family",
"name": "uses"
}
],
"category": "vendor",
"name": "Example Company"
}
]
}
```

> The complete JSON path contains 31 times `branches`.
Loading

0 comments on commit eea00eb

Please sign in to comment.