File tree Expand file tree Collapse file tree 3 files changed +219
-0
lines changed
test/specs/nested-pointers Expand file tree Collapse file tree 3 files changed +219
-0
lines changed Original file line number Diff line number Diff line change 1+ internal1 :
2+ $ref : " #/internal2"
3+ internal2 :
4+ $ref : " #/external"
Original file line number Diff line number Diff line change 1+ import { describe , it } from "vitest" ;
2+ import { expect } from "vitest" ;
3+ import $RefParser from "../../../lib/index.js" ;
4+ const schema = {
5+ type : "object" ,
6+ allOf : [
7+ {
8+ description : "REMOVED for better readbility" ,
9+ } ,
10+ {
11+ type : "object" ,
12+ properties : {
13+ payload : {
14+ type : "array" ,
15+ items : {
16+ allOf : [
17+ {
18+ description : "REMOVED for better readbility" ,
19+ } ,
20+ {
21+ type : "object" ,
22+ properties : {
23+ reservationActionMetaData : {
24+ allOf : [
25+ {
26+ allOf : [
27+ {
28+ type : "object" ,
29+ properties : {
30+ supplierPriceElements : {
31+ allOf : [
32+ {
33+ description : "REMOVED for better readbility" ,
34+ } ,
35+ {
36+ type : "object" ,
37+ properties : {
38+ purchaseRate : {
39+ allOf : [
40+ {
41+ type : "object" ,
42+ required : [ "amount" ] ,
43+ properties : {
44+ amount : {
45+ type : "number" ,
46+ } ,
47+ } ,
48+ } ,
49+ {
50+ type : "object" ,
51+ properties : {
52+ inDetail : {
53+ type : "object" ,
54+ properties : {
55+ perDate : {
56+ type : "array" ,
57+ items : {
58+ type : "object" ,
59+ properties : {
60+ amount : {
61+ $ref : "#/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/fee/properties/modificationFee/properties/amount" ,
62+ } ,
63+ } ,
64+ } ,
65+ } ,
66+ } ,
67+ } ,
68+ } ,
69+ } ,
70+ ] ,
71+ } ,
72+ fee : {
73+ type : "object" ,
74+ properties : {
75+ modificationFee : {
76+ $ref : "#/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/purchaseRate/allOf/0" ,
77+ } ,
78+ } ,
79+ } ,
80+ } ,
81+ } ,
82+ ] ,
83+ } ,
84+ } ,
85+ } ,
86+ {
87+ description : "REMOVED for better readbility" ,
88+ } ,
89+ ] ,
90+ } ,
91+ {
92+ description : "REMOVED for better readbility" ,
93+ } ,
94+ ] ,
95+ } ,
96+ } ,
97+ } ,
98+ ] ,
99+ } ,
100+ } ,
101+ } ,
102+ } ,
103+ ] ,
104+ } ;
105+
106+ describe ( "Schema with nested pointers" , ( ) => {
107+ it ( "should throw an error for missing pointer" , async ( ) => {
108+ // todo - get original schema from #338
109+ const bundle = await $RefParser . bundle ( schema ) ;
110+ expect ( bundle ) . to . equal ( schema ) ;
111+ } ) ;
112+ } ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "type" : " object" ,
3+ "allOf" : [
4+ {
5+ "description" : " REMOVED for better readbility"
6+ },
7+ {
8+ "type" : " object" ,
9+ "properties" : {
10+ "payload" : {
11+ "type" : " array" ,
12+ "items" : {
13+ "allOf" : [
14+ {
15+ "description" : " REMOVED for better readbility"
16+ },
17+ {
18+ "type" : " object" ,
19+ "properties" : {
20+ "reservationActionMetaData" : {
21+ "allOf" : [
22+ {
23+ "allOf" : [
24+ {
25+ "type" : " object" ,
26+ "properties" : {
27+ "supplierPriceElements" : {
28+ "allOf" : [
29+ {
30+ "description" : " REMOVED for better readbility"
31+ },
32+ {
33+ "type" : " object" ,
34+ "properties" : {
35+ "purchaseRate" : {
36+ "allOf" : [
37+ {
38+ "type" : " object" ,
39+ "required" : [
40+ " amount"
41+ ],
42+ "properties" : {
43+ "amount" : {
44+ "type" : " number"
45+ }
46+ }
47+ },
48+ {
49+ "type" : " object" ,
50+ "properties" : {
51+ "inDetail" : {
52+ "type" : " object" ,
53+ "properties" : {
54+ "perDate" : {
55+ "type" : " array" ,
56+ "items" : {
57+ "type" : " object" ,
58+ "properties" : {
59+ "amount" : {
60+ "$ref" : " #/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/fee/properties/modificationFee/properties/amount"
61+ }
62+ }
63+ }
64+ }
65+ }
66+ }
67+ }
68+ }
69+ ]
70+ },
71+ "fee" : {
72+ "type" : " object" ,
73+ "properties" : {
74+ "modificationFee" : {
75+ "$ref" : " #/allOf/1/properties/payload/items/allOf/1/properties/reservationActionMetaData/allOf/0/allOf/0/properties/supplierPriceElements/allOf/1/properties/purchaseRate/allOf/0"
76+ }
77+ }
78+ }
79+ }
80+ }
81+ ]
82+ }
83+ }
84+ },
85+ {
86+ "description" : " REMOVED for better readbility"
87+ }
88+ ]
89+ },
90+ {
91+ "description" : " REMOVED for better readbility"
92+ }
93+ ]
94+ }
95+ }
96+ }
97+ ]
98+ }
99+ }
100+ }
101+ }
102+ ]
103+ }
You can’t perform that action at this time.
0 commit comments