Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...makecomment(schema),
table('left', [
// iterate over header
tableRow(
flist(
map(headerprops,
({ name, title }) => {
if (links[name]) {
return tableCell(link(links[name], i18n`What does ${title} mean?`, text(title)));
}
return tableCell(text(title));
}), Array,
),
),
tableRow(
flist(
map(headerprops,
(prop) => {
// this is a linked property
if (schema[s.meta]
&& typeof schema[s.meta][prop.name] === 'object'
&& schema[s.meta][prop.name].link
&& schema[s.meta][prop.name].text) {
return tableCell(link(rewritelinks(schema[s.meta][prop.name].link), i18n`open original schema`, [text(schema[s.meta][prop.name].text)]));
}
const value = schema[s.meta] ? schema[s.meta][prop.name] : undefined;
return tableCell(text(prop[`${String(value)}label`] || i18n`Unknown`));
}), Array,
),
),
]),
];
function makeproplist(properties = {},
patternProperties = {},
additionalProperties,
required,
level = 2) {
return [
...flist(flat(Object.entries(properties || {}).map(([name, definition]) => {
const description = definition[s.meta] && definition[s.meta].longdescription ? definition[s.meta].longdescription : paragraph(text(i18n`no description`));
return [
heading(level + 1, text(name)),
description,
...makecomment(definition),
paragraph(inlineCode(name)),
makefactlist(name, definition, required),
...maketypesection(definition, level + 1),
...makeconstraintssection(definition, level + 1),
...makedefault(definition, level + 1),
...makeexamples(definition, level + 1),
...makerestrictions(definition, level + 1),
];
}))),
...flist(flat(Object.entries(patternProperties || {}).map(([name, definition]) => {
function makeversionnote(schemas) {
const versions = flist(uniq(schemas
.map(schema => schema[keyword`$schema`])
.filter(e => !!e)));
if (versions.length === 1) {
return [
heading(2, text(i18n`Version Note`)),
paragraph([
text('The schemas linked above follow the JSON Schema Spec version: '),
inlineCode(versions[0]),
]),
];
}
return [];
}