Aktueller Stand
This commit is contained in:
53
backend/node_modules/json-schema-ref-resolver/test/deref-schema.test.js
generated
vendored
53
backend/node_modules/json-schema-ref-resolver/test/deref-schema.test.js
generated
vendored
@@ -45,7 +45,7 @@ test('should throw id source schema has a key with a same key as ref schema, but
|
||||
} catch (err) {
|
||||
assert.strictEqual(
|
||||
err.message,
|
||||
'Cannot resolve ref "schemaId2". Property "properties" is already exist in schema "schemaId1".'
|
||||
'Cannot resolve ref "schemaId2". Property "properties" already exists in schema "schemaId1".'
|
||||
)
|
||||
}
|
||||
})
|
||||
@@ -234,3 +234,54 @@ test('should throw if target ref schema is not found', () => {
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
test('should deref schema without root $id', () => {
|
||||
const refResolver = new RefResolver()
|
||||
|
||||
const schemaId = 'schemaId1'
|
||||
const schema = {
|
||||
type: 'object',
|
||||
definitions: {
|
||||
id1: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id1: {
|
||||
type: 'integer'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
allOf: [
|
||||
{
|
||||
$ref: '#/definitions/id1'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
refResolver.addSchema(schema, schemaId)
|
||||
const derefSchema = refResolver.getDerefSchema(schemaId)
|
||||
|
||||
assert.deepStrictEqual(derefSchema, {
|
||||
type: 'object',
|
||||
definitions: {
|
||||
id1: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id1: {
|
||||
type: 'integer'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
allOf: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
id1: {
|
||||
type: 'integer'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user