-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect unguarded recursion when inspecting object properties and simi…
…lar things (#128) * Do check for unguarded recursion in the "silent" branches of schema processing * Add test * Make test more throrough * Fixed tests Signed-off-by: iko <[email protected]> Co-authored-by: iko <[email protected]>
- Loading branch information
Showing
11 changed files
with
88 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
components: | ||
schemas: | ||
A: | ||
type: object | ||
properties: | ||
bar: | ||
$ref: "#/components/schemas/B" | ||
B: | ||
anyOf: | ||
- $ref: "#/components/schemas/B" | ||
type: object | ||
openapi: 3.0.0 | ||
info: | ||
version: "" | ||
title: "" | ||
paths: | ||
/foo: | ||
get: | ||
responses: | ||
"200": | ||
content: | ||
application/json;charset=utf-8: | ||
schema: | ||
$ref: "#/components/schemas/A" | ||
description: "" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
components: | ||
schemas: {} | ||
openapi: 3.0.0 | ||
info: | ||
version: "" | ||
title: "" | ||
paths: | ||
/foo: | ||
get: | ||
responses: | ||
"200": | ||
content: | ||
application/json;charset=utf-8: | ||
schema: | ||
type: object | ||
properties: | ||
bar: | ||
type: object | ||
description: "" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Summary | ||
|
||
| ❌ Breaking changes | ⚠️ Non-breaking changes | [❓ Unsupported feature changes](#unsupported-changes) | | ||
|---------------------|-------------------------|--------------------------------------------------------| | ||
| 0 | 0 | 1 | | ||
|
||
# <span id="unsupported-changes"></span>❓ Unsupported feature changes | ||
|
||
## **GET** /foo | ||
|
||
### ⬅️☁️ JSON Response – 200 | ||
|
||
#### `$.bar` | ||
|
||
Encountered recursion that is too complex for CompaREST to untangle. |
16 changes: 16 additions & 0 deletions
16
test/golden/common/unguarded-recursive/silent/trace-tree.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
forwardChanges: | ||
AtPath "/foo": | ||
InOperation GetMethod: | ||
WithStatusCode 200: | ||
ResponsePayload: | ||
PayloadSchema: | ||
OfType Object: | ||
InProperty "bar": UnguardedRecursion | ||
backwardChanges: | ||
AtPath "/foo": | ||
InOperation GetMethod: | ||
WithStatusCode 200: | ||
ResponsePayload: | ||
PayloadSchema: | ||
OfType Object: | ||
InProperty "bar": UnguardedRecursion |