-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(resolver): collect errors in ExampleElement visitor hook
This change in specific to OpenAPI 3.1.0 resolution strategy. Errors are now collected, instead of thrown and visitor tranversal is not interrupted. Refs #2798
- Loading branch information
Showing
6 changed files
with
138 additions
and
14 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...pidom/reference/dereference/strategies/openapi-3-1-swagger-client/utils/get-root-cause.js
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,17 @@ | ||
/** | ||
* Retrieves the root cause of ApiDOM error hierarchy. | ||
* ApiDOM error hierarchies are modeled similar to Java. | ||
* Every error can have cause attribute which references | ||
* cause of this error. | ||
*/ | ||
const getRootCause = (error) => { | ||
if (error.cause == null) return error; | ||
|
||
let { cause } = error; | ||
while (cause.cause != null) { | ||
cause = cause.cause; | ||
} | ||
return cause; | ||
}; | ||
|
||
export default getRootCause; |
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
13 changes: 13 additions & 0 deletions
13
...-swagger-client/example-object/__fixtures__/external-value-unresolvable/dereferenced.json
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,13 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"examples": { | ||
"example1": { | ||
"description": "example1 description", | ||
"externalValue": "./ex.json" | ||
} | ||
} | ||
} | ||
} | ||
] |
14 changes: 14 additions & 0 deletions
14
...er-client/example-object/__fixtures__/external-value-value-both-defined/dereferenced.json
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,14 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"examples": { | ||
"example1": { | ||
"description": "example1 description", | ||
"value": "sample value", | ||
"externalValue": "./ex.json" | ||
} | ||
} | ||
} | ||
} | ||
] |
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