When the schema itself contains a key "$schema": "https://json-schema.org/draft/2020-12/schema", this is thrown as an error.
Reproduction:
it('should succeed', () => {
const schema = {
$id: 'https://my-schema.org/SomeObject.json',
$schema: 'https://json-schema.org/draft/2020-12/schema',
title: 'Some title',
description: 'Some description',
type: 'object',
additionalProperties: true,
properties: {
id: {
description: 'An id',
type: 'string',
},
},
}
expect({
$schema: 'https://my-schema.org/SomeObject.json',
id: 'some id',
}).toMatchSchema(schema)
})
Expected
The unit test should succeed
Actual
The unit test fails with this error:
no schema with key or ref "https://json-schema.org/draft/2020-12/schema"
When the schema itself contains a key
"$schema": "https://json-schema.org/draft/2020-12/schema", this is thrown as an error.Reproduction:
Expected
The unit test should succeed
Actual
The unit test fails with this error: