-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
219 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
internal1: | ||
$ref: "#/internal2" | ||
internal2: | ||
$ref: "#/external" |
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,112 @@ | ||
import { describe, it } from "vitest"; | ||
import { expect } from "vitest"; | ||
import $RefParser from "../../../lib/index.js"; | ||
const schema = { | ||
type: "object", | ||
allOf: [ | ||
{ | ||
description: "REMOVED for better readbility", | ||
}, | ||
{ | ||
type: "object", | ||
properties: { | ||
payload: { | ||
type: "array", | ||
items: { | ||
allOf: [ | ||
{ | ||
description: "REMOVED for better readbility", | ||
}, | ||
{ | ||
type: "object", | ||
properties: { | ||
reservationActionMetaData: { | ||
allOf: [ | ||
{ | ||
allOf: [ | ||
{ | ||
type: "object", | ||
properties: { | ||
supplierPriceElements: { | ||
allOf: [ | ||
{ | ||
description: "REMOVED for better readbility", | ||
}, | ||
{ | ||
type: "object", | ||
properties: { | ||
purchaseRate: { | ||
allOf: [ | ||
{ | ||
type: "object", | ||
required: ["amount"], | ||
properties: { | ||
amount: { | ||
type: "number", | ||
}, | ||
}, | ||
}, | ||
{ | ||
type: "object", | ||
properties: { | ||
inDetail: { | ||
type: "object", | ||
properties: { | ||
perDate: { | ||
type: "array", | ||
items: { | ||
type: "object", | ||
properties: { | ||
amount: { | ||
$ref: "#/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/fee/properties/modificationFee/properties/amount", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
fee: { | ||
type: "object", | ||
properties: { | ||
modificationFee: { | ||
$ref: "#/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/purchaseRate/allOf/0", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
{ | ||
description: "REMOVED for better readbility", | ||
}, | ||
], | ||
}, | ||
{ | ||
description: "REMOVED for better readbility", | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
describe("Schema with nested pointers", () => { | ||
it("should throw an error for missing pointer", async () => { | ||
// todo - get original schema from #338 | ||
const bundle = await $RefParser.bundle(schema); | ||
expect(bundle).to.equal(schema); | ||
}); | ||
}); |
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,103 @@ | ||
{ | ||
"type": "object", | ||
"allOf": [ | ||
{ | ||
"description": "REMOVED for better readbility" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"payload": { | ||
"type": "array", | ||
"items": { | ||
"allOf": [ | ||
{ | ||
"description": "REMOVED for better readbility" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"reservationActionMetaData": { | ||
"allOf": [ | ||
{ | ||
"allOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"supplierPriceElements": { | ||
"allOf": [ | ||
{ | ||
"description": "REMOVED for better readbility" | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"purchaseRate": { | ||
"allOf": [ | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"amount" | ||
], | ||
"properties": { | ||
"amount": { | ||
"type": "number" | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"inDetail": { | ||
"type": "object", | ||
"properties": { | ||
"perDate": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"amount": { | ||
"$ref": "#/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/fee/properties/modificationFee/properties/amount" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"fee": { | ||
"type": "object", | ||
"properties": { | ||
"modificationFee": { | ||
"$ref": "#/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/purchaseRate/allOf/0" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"description": "REMOVED for better readbility" | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "REMOVED for better readbility" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |