A plain JavaScript validator for AT Protocol lexicon schemas
at main 94 lines 1.7 kB view raw
1// Test inputs for array schema validation 2 3export const arraySchemaInputs = [ 4 { 5 name: 'array-valid-string-items', 6 lexicon: { 7 lexicon: 1, 8 id: 'test.array.stringitems', 9 defs: { 10 main: { 11 type: 'array', 12 items: { type: 'string' }, 13 minLength: 1, 14 maxLength: 10, 15 }, 16 }, 17 }, 18 }, 19 { 20 name: 'array-valid-object-items', 21 lexicon: { 22 lexicon: 1, 23 id: 'test.array.objectitems', 24 defs: { 25 main: { 26 type: 'array', 27 items: { 28 type: 'object', 29 properties: { 30 name: { type: 'string' }, 31 }, 32 }, 33 }, 34 }, 35 }, 36 }, 37 { 38 name: 'array-valid-nested-array', 39 lexicon: { 40 lexicon: 1, 41 id: 'test.array.nested', 42 defs: { 43 main: { 44 type: 'array', 45 items: { 46 type: 'array', 47 items: { type: 'integer' }, 48 }, 49 }, 50 }, 51 }, 52 }, 53 { 54 name: 'array-invalid-missing-items', 55 lexicon: { 56 lexicon: 1, 57 id: 'test.array.noitems', 58 defs: { 59 main: { 60 type: 'array', 61 maxLength: 10, 62 }, 63 }, 64 }, 65 }, 66 { 67 name: 'array-invalid-length-constraints', 68 lexicon: { 69 lexicon: 1, 70 id: 'test.array.badlength', 71 defs: { 72 main: { 73 type: 'array', 74 items: { type: 'string' }, 75 minLength: 10, 76 maxLength: 5, 77 }, 78 }, 79 }, 80 }, 81 { 82 name: 'array-valid-no-constraints', 83 lexicon: { 84 lexicon: 1, 85 id: 'test.array.noconstraints', 86 defs: { 87 main: { 88 type: 'array', 89 items: { type: 'string' }, 90 }, 91 }, 92 }, 93 }, 94];