1*97bd480fSBaptiste Daroussin[ 2*97bd480fSBaptiste Daroussin { 3*97bd480fSBaptiste Daroussin "description": "additionalItems as schema", 4*97bd480fSBaptiste Daroussin "schema": { 5*97bd480fSBaptiste Daroussin "items": [{}], 6*97bd480fSBaptiste Daroussin "additionalItems": {"type": "integer"} 7*97bd480fSBaptiste Daroussin }, 8*97bd480fSBaptiste Daroussin "tests": [ 9*97bd480fSBaptiste Daroussin { 10*97bd480fSBaptiste Daroussin "description": "additional items match schema", 11*97bd480fSBaptiste Daroussin "data": [ null, 2, 3, 4 ], 12*97bd480fSBaptiste Daroussin "valid": true 13*97bd480fSBaptiste Daroussin }, 14*97bd480fSBaptiste Daroussin { 15*97bd480fSBaptiste Daroussin "description": "additional items do not match schema", 16*97bd480fSBaptiste Daroussin "data": [ null, 2, 3, "foo" ], 17*97bd480fSBaptiste Daroussin "valid": false 18*97bd480fSBaptiste Daroussin } 19*97bd480fSBaptiste Daroussin ] 20*97bd480fSBaptiste Daroussin }, 21*97bd480fSBaptiste Daroussin { 22*97bd480fSBaptiste Daroussin "description": "items is schema, no additionalItems", 23*97bd480fSBaptiste Daroussin "schema": { 24*97bd480fSBaptiste Daroussin "items": {}, 25*97bd480fSBaptiste Daroussin "additionalItems": false 26*97bd480fSBaptiste Daroussin }, 27*97bd480fSBaptiste Daroussin "tests": [ 28*97bd480fSBaptiste Daroussin { 29*97bd480fSBaptiste Daroussin "description": "all items match schema", 30*97bd480fSBaptiste Daroussin "data": [ 1, 2, 3, 4, 5 ], 31*97bd480fSBaptiste Daroussin "valid": true 32*97bd480fSBaptiste Daroussin } 33*97bd480fSBaptiste Daroussin ] 34*97bd480fSBaptiste Daroussin }, 35*97bd480fSBaptiste Daroussin { 36*97bd480fSBaptiste Daroussin "description": "array of items with no additionalItems", 37*97bd480fSBaptiste Daroussin "schema": { 38*97bd480fSBaptiste Daroussin "items": [{}, {}, {}], 39*97bd480fSBaptiste Daroussin "additionalItems": false 40*97bd480fSBaptiste Daroussin }, 41*97bd480fSBaptiste Daroussin "tests": [ 42*97bd480fSBaptiste Daroussin { 43*97bd480fSBaptiste Daroussin "description": "no additional items present", 44*97bd480fSBaptiste Daroussin "data": [ 1, 2, 3 ], 45*97bd480fSBaptiste Daroussin "valid": true 46*97bd480fSBaptiste Daroussin }, 47*97bd480fSBaptiste Daroussin { 48*97bd480fSBaptiste Daroussin "description": "additional items are not permitted", 49*97bd480fSBaptiste Daroussin "data": [ 1, 2, 3, 4 ], 50*97bd480fSBaptiste Daroussin "valid": false 51*97bd480fSBaptiste Daroussin } 52*97bd480fSBaptiste Daroussin ] 53*97bd480fSBaptiste Daroussin }, 54*97bd480fSBaptiste Daroussin { 55*97bd480fSBaptiste Daroussin "description": "additionalItems as false without items", 56*97bd480fSBaptiste Daroussin "schema": {"additionalItems": false}, 57*97bd480fSBaptiste Daroussin "tests": [ 58*97bd480fSBaptiste Daroussin { 59*97bd480fSBaptiste Daroussin "description": 60*97bd480fSBaptiste Daroussin "items defaults to empty schema so everything is valid", 61*97bd480fSBaptiste Daroussin "data": [ 1, 2, 3, 4, 5 ], 62*97bd480fSBaptiste Daroussin "valid": true 63*97bd480fSBaptiste Daroussin }, 64*97bd480fSBaptiste Daroussin { 65*97bd480fSBaptiste Daroussin "description": "ignores non-arrays", 66*97bd480fSBaptiste Daroussin "data": {"foo" : "bar"}, 67*97bd480fSBaptiste Daroussin "valid": true 68*97bd480fSBaptiste Daroussin } 69*97bd480fSBaptiste Daroussin ] 70*97bd480fSBaptiste Daroussin }, 71*97bd480fSBaptiste Daroussin { 72*97bd480fSBaptiste Daroussin "description": "additionalItems are allowed by default", 73*97bd480fSBaptiste Daroussin "schema": {"items": [{"type": "integer"}]}, 74*97bd480fSBaptiste Daroussin "tests": [ 75*97bd480fSBaptiste Daroussin { 76*97bd480fSBaptiste Daroussin "description": "only the first item is validated", 77*97bd480fSBaptiste Daroussin "data": [1, "foo", false], 78*97bd480fSBaptiste Daroussin "valid": true 79*97bd480fSBaptiste Daroussin } 80*97bd480fSBaptiste Daroussin ] 81*97bd480fSBaptiste Daroussin } 82*97bd480fSBaptiste Daroussin] 83