Impossible to bundle JSON Schema draft-04 itself.
Here is my basic schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"schema": {
"$ref": "http://json-schema.org/draft-04/schema",
"title": "schema"
},
"tags": {
"items": {
"enum": [
"forge"
],
"type": "string"
},
"title": "tags",
"type": "array"
},
},
"required": [
"schema"
],
"type": "object"
}
My code is:
const $RefParser = require('json-schema-ref-parser');
$RefParser.bundle("schema.json").then(schema => {
console.log(JSON.stringify(schema, null, 2));
}).catch(e => {
console.error(e);
});
As you can see in "$ref": "http://json-schema.org/draft-04/schema",, I want to bundle the draft-04 schema. Instead, my output is:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"schema": {
"$ref": "#/properties/schema/properties/not",
"title": "schema"
},
"tags": {
"items": {
"enum": [
"forge"
],
"type": "string"
},
"title": "tags",
"type": "array"
}
},
"required": [
"schema"
],
"type": "object"
}
That's not even a valid schema. This looks like a bug to me but I would be very interested in understanding what I have done wrong.
Can somebody please confirm if this is a bug? Cheers.
Oh, here is a complete bundle of a sample app. error-example.zip
Can you expand on why this needs to work? Not sure of the use case or what is happening, the issue is pretty sparse.
@philsturgeon If I want to have a JSON value, that contains a JSON Schema at v4, then I should be able to just reference the v4 schema as a validator. And then when I run the bundle tool here on it, it should make sure that it is bundled inline and that everything works as expected.
What do I need to provide such that the use case is easier to understand here? I'm confused that it's not clear that this is a bug and what the expected output would be.
What tool are you passing this JSON value too that it needs the JSON Schema $schema definition bundled in? Why would a tool want or need that to be done?