Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the generated schema compliant with draft04 #600

Merged
merged 1 commit into from Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/generate-schema.js
Expand Up @@ -13,7 +13,13 @@ const jsonSchema = {
}

// template is only required after deep merged, should not be required in the JSON schema
jsonSchema.required = jsonSchema.required.filter((item) => item !== 'template')
// we should also remove the required field in case nothing remains after the filtering to keep draft04 compatibility
const requiredField = jsonSchema.required.filter((item) => item !== 'template')
if (requiredField.length) {
jsonSchema.required = requiredField
} else {
delete jsonSchema.required
}

if (args[0] === 'print') {
fs.writeFileSync('./schema.json', `${JSON.stringify(jsonSchema, null, 2)}\n`)
Expand Down
3 changes: 1 addition & 2 deletions schema.json
Expand Up @@ -197,6 +197,5 @@
}
},
"additionalProperties": false,
"patterns": [],
"required": []
"patterns": []
}