-
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 SchemaElement visitor hook (#2807)
This change is specific to OpenAPI 3.1.0 resolution strategy. Errors are now collected, instead of thrown and visitor traversal is not interrupted. Refs #2806
- Loading branch information
Showing
16 changed files
with
781 additions
and
318 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...elpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/errors/index.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,7 @@ | ||
import createError from '../../../../../../../specmap/lib/create-error.js'; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const SchemaRefError = createError('SchemaRefError', function cb(message, extra, oriError) { | ||
this.originalError = oriError; | ||
Object.assign(this, extra || {}); | ||
}); |
329 changes: 176 additions & 153 deletions
329
...pidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/dereference.js
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...openapi-3-1-swagger-client/schema-object/__fixtures__/$anchor-not-found/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,23 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"type": "object", | ||
"properties": { | ||
"login": { | ||
"type": "string" | ||
}, | ||
"password": { | ||
"type": "string" | ||
}, | ||
"profile": { | ||
"$ref": "#user-profile" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] |
25 changes: 25 additions & 0 deletions
25
.../openapi-3-1-swagger-client/schema-object/__fixtures__/$id-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,25 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"$id": "./schemas/", | ||
"type": "object", | ||
"properties": { | ||
"login": { | ||
"type": "string" | ||
}, | ||
"password": { | ||
"type": "string" | ||
}, | ||
"profile": { | ||
"$id": "./nested/", | ||
"$ref": "./ex.json" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] |
23 changes: 23 additions & 0 deletions
23
...api-3-1-swagger-client/schema-object/__fixtures__/$ref-url-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,23 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"type": "object", | ||
"properties": { | ||
"login": { | ||
"type": "string" | ||
}, | ||
"password": { | ||
"type": "string" | ||
}, | ||
"profile": { | ||
"$ref": "./ex.json" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] |
23 changes: 23 additions & 0 deletions
23
...api-3-1-swagger-client/schema-object/__fixtures__/$ref-urn-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,23 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"type": "object", | ||
"properties": { | ||
"login": { | ||
"type": "string" | ||
}, | ||
"password": { | ||
"type": "string" | ||
}, | ||
"profile": { | ||
"$ref": "urn:uuid:3" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
...-3-1-swagger-client/schema-object/__fixtures__/direct-external-circular/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,10 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": {} | ||
} | ||
} | ||
} | ||
] |
12 changes: 12 additions & 0 deletions
12
...-3-1-swagger-client/schema-object/__fixtures__/direct-internal-circular/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,12 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"$ref": "#/components/schemas/User" | ||
} | ||
} | ||
} | ||
} | ||
] |
10 changes: 10 additions & 0 deletions
10
...-1-swagger-client/schema-object/__fixtures__/indirect-external-circular/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,10 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": {} | ||
} | ||
} | ||
} | ||
] |
13 changes: 13 additions & 0 deletions
13
...-1-swagger-client/schema-object/__fixtures__/indirect-internal-circular/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": { | ||
"schemas": { | ||
"User": {}, | ||
"Indirection1": {}, | ||
"Indirection2": {}, | ||
"Indirection3": {} | ||
} | ||
} | ||
} | ||
] |
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
15 changes: 15 additions & 0 deletions
15
...penapi-3-1-swagger-client/schema-object/__fixtures__/infinite-recursion/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,15 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"type": "object" | ||
}, | ||
"UserProfile": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
] |
13 changes: 13 additions & 0 deletions
13
...s/openapi-3-1-swagger-client/schema-object/__fixtures__/invalid-pointer/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": { | ||
"schemas": { | ||
"User": { | ||
"type": "object", | ||
"$ref": "#/components/schemas/invalid-pointer" | ||
} | ||
} | ||
} | ||
} | ||
] |
12 changes: 12 additions & 0 deletions
12
...ategies/openapi-3-1-swagger-client/schema-object/__fixtures__/max-depth/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,12 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"type": "object" | ||
} | ||
} | ||
} | ||
} | ||
] |
16 changes: 16 additions & 0 deletions
16
...pi-3-1-swagger-client/schema-object/__fixtures__/unresolvable-reference/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,16 @@ | ||
[ | ||
{ | ||
"openapi": "3.1.0", | ||
"components": { | ||
"schemas": { | ||
"User": { | ||
"properties": { | ||
"profile": { | ||
"$ref": "#/components/schemas/UserProfile" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] |
Oops, something went wrong.