Skip to content

Commit

Permalink
test(resolver): add tests for OpenAPI 3.1 useCircularStructures opt
Browse files Browse the repository at this point in the history
Closes #2761
  • Loading branch information
char0n committed Jan 23, 2023
1 parent b1f1f04 commit 1d9a8f8
Show file tree
Hide file tree
Showing 43 changed files with 1,484 additions and 60 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"dependencies": {
"@babel/runtime-corejs3": "^7.11.2",
"@swagger-api/apidom-core": "^0.63.0",
"@swagger-api/apidom-reference": "^0.63.0",
"@swagger-api/apidom-reference": "^0.63.1",
"@swagger-api/apidom-ns-openapi-3-1": "^0.63.0",
"@swagger-api/apidom-json-pointer": "^0.63.0",
"cookie": "~0.5.0",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ describe('dereference', () => {
const parseResult = await parse(uri, {
parse: { mediaType: mediaTypes.latest('json') },
});
// @ts-ignore
const referenceElement = parseResult.api?.components.parameters.get('externalRef');
const refSet = ReferenceSet();
const rootFileReference = Reference({ uri, value: parseResult });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$anchor": "user-profile",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"parent": {
"$ref": "/home/smartbear/ex.json#user-profile"
}
}
}
}
}
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$defs": {
"UserProfile": {
"$anchor": "user-profile",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"parent": {
"$ref": "#user-profile"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$ref": "./ex.json#user-profile"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$anchor": "user-profile",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"parent": {
"$ref": "/home/smartbear/root.json#user-profile"
}
}
}
}
},
"UserProfile": {
"$anchor": "user-profile",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"parent": {
"$ref": "/home/smartbear/root.json#user-profile"
}
}
}
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$ref": "#user-profile"
}
}
},
"UserProfile": {
"$anchor": "user-profile",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"parent": {
"$ref": "#user-profile"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$id": "./nested/",
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"user": {
"$ref": "/home/smartbear/root.json#/components/schemas/User"
}
}
}
}
}
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"user": {
"$ref": "../root.json#/components/schemas/User"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$id": "./nested/",
"$ref": "./ex.json"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"$id": "./nested/",
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"user": {
"$ref": "/home/smartbear/root.json#/components/schemas/User"
}
}
}
}
}
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"user": {
"$ref": "../root.json#/components/schemas/User"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"$id": "./nested/",
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$ref": "./ex.json"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$id": "./nested/",
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"user": {
"$ref": "/home/smartbear/root.json#/components/schemas/User"
}
}
}
}
}
}
}
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$defs": {
"UserProfile": {
"$id": "./nested/",
"$ref": "./ex.json"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"user": {
"$ref": "../../root.json#/components/schemas/User"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"openapi": "3.1.0",
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
},
"profile": {
"$ref": "./nested/ex.json#/$defs/UserProfile"
}
}
}
}
}
}
Loading

0 comments on commit 1d9a8f8

Please sign in to comment.