download
raw
1.06 kB
'use strict'
const { test } = require('node:test')
const build = require('..')
test('nested ref requires ajv', async t => {
t.test('nested ref requires ajv', async t => {
const schemaA = {
$id: 'urn:schema:a',
definitions: {
foo: { anyOf: [{ type: 'string' }, { type: 'null' }] }
}
}
const schemaB = {
$id: 'urn:schema:b',
type: 'object',
properties: {
results: {
type: 'object',
properties: {
items: {
type: 'object',
properties: {
bar: {
type: 'array',
items: { $ref: 'urn:schema:a#/definitions/foo' }
}
}
}
}
}
}
}
const stringify = build(schemaB, {
schema: {
[schemaA.$id]: schemaA
}
})
const result = stringify({
results: {
items: {
bar: ['baz']
}
}
})
t.assert.equal(result, '{"results":{"items":{"bar":["baz"]}}}')
})
})

Xet Storage Details

Size:
1.06 kB
·
Xet hash:
9fb99c13ba3c759c3614879d6dee8fbc1022a9ae2ebbdfa98bd16ca87606bf9a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.