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AO,SAAS,GAC3B,QAAS,CACV,IAAG,KAAK,OACT","file":"/npm/json-schema-to-markdown@1.1.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/json-schema-to-markdown@1.1.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var coreSchemaTypes = [\n\t'array',\n\t'boolean',\n\t'integer',\n\t'number',\n\t'null',\n\t'object',\n\t'string'\n]\n\nfunction generateElementTitle(octothorpes, elementName, elementType, isRequired, isEnum, example) {\n\tvar text = [ octothorpes ]\n\tif(elementName) {\n\t\ttext.push(' `' + elementName + '`')\n\t}\n\tif (elementType || isRequired) {\n\t\ttext.push(' (')\n\t\tif (elementType) {\n\t\t\ttext.push(elementType)\n\t\t}\n\t\tif (isEnum) {\n\t\t\ttext.push(', enum')\n\t\t}\n\t\tif (isRequired) {\n\t\t\ttext.push(', required')\n\t\t}\n\t\ttext.push(')')\n\t}\n\tif (example) {\n\t\ttext.push(' eg: `' + example + '`')\n\t}\n\treturn text.join('')\n}\n\nfunction generatePropertyRestrictions(schema) {\n\tvar generate = generateSinglePropertyRestriction(schema)\n\treturn [\n\t\tgenerate('minimum', 'Minimum'),\n\t\tgenerate('maximum', 'Maximum'),\n\t\tgenerate('pattern', 'Regex pattern'),\n\t\tgenerate('minItems', 'Minimum items'),\n\t\tgenerate('uniqueItems', 'Unique items')\n\t].filter(function(text) {\n\t\treturn text\n\t}).join('\\n')\n}\n\nfunction generateSinglePropertyRestriction(schema) {\n\treturn function(key, text) {\n\t\tif (schema[key]) {\n\t\t\treturn '* ' + text + ': `' + schema[key] + '`'\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n}\n\nfunction generateSchemaSectionText(octothorpes, name, isRequired, schema, subSchemas) {\n\tvar schemaType = getActualType(schema, subSchemas)\n\n\tvar text = [\n\t\tgenerateElementTitle(octothorpes, name, schemaType, isRequired, schema.enum, schema.example),\n\t\tschema.description\n\t]\n\n\tif (schemaType === 'object') {\n\t\tif (schema.properties) {\n\t\t\ttext.push('Properties of the `' + name + '` object:')\n\t\t\tgeneratePropertySection(octothorpes, schema, subSchemas).forEach(function(section) {\n\t\t\t\ttext = text.concat(section)\n\t\t\t})\n\t\t}\n\t} else if (schemaType === 'array') {\n\t\tvar itemsType = schema.items && schema.items.type\n\n\t\tif (!itemsType && schema.items['$ref']) {\n\t\t\titemsType = getActualType(schema.items, subSchemas)\n\t\t}\n\n\t\tif (itemsType && name) {\n\t\t\ttext.push('The object is an array with all elements of the type `' + itemsType + '`.')\n\t\t} else if (itemsType) {\n\t\t\ttext.push('The schema defines an array with all elements of the type `' + itemsType + '`.')\n\t\t} else {\n\t\t\tvar validationItems = []\n\n\t\t\tif (schema.items.allOf) {\n\t\t\t\ttext.push('The elements of the array must match *all* of the following properties:')\n\t\t\t\tvalidationItems = schema.items.allOf\n\t\t\t} else if (schema.items.anyOf) {\n\t\t\t\ttext.push('The elements of the array must match *at least one* of the following properties:')\n\t\t\t\tvalidationItems = schema.items.anyOf\n\t\t\t} else if (schema.items.oneOf) {\n\t\t\t\ttext.push('The elements of the array must match *exactly one* of the following properties:')\n\t\t\t\tvalidationItems = schema.items.oneOf\n\t\t\t} else if (schema.items.not) {\n\t\t\t\ttext.push('The elements of the array must *not* match the following properties:')\n\t\t\t\tvalidationItems = schema.items.not\n\t\t\t}\n\n\t\t\tif (validationItems.length > 0) {\n\t\t\t\tvalidationItems.forEach(function(item) {\n\t\t\t\t\ttext = text.concat(generateSchemaSectionText(octothorpes, item.title, false, item, subSchemas))\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tif (itemsType === 'object') {\n\t\t\ttext.push('The array object has the following properties:')\n\t\t\tgeneratePropertySection(octothorpes, schema.items, subSchemas).forEach(function(section) {\n\t\t\t\ttext = text.concat(section)\n\t\t\t})\n\t\t}\n\t} else if (schema.oneOf) {\n\t\ttext.push('The object must be one of the following types:')\n\t\ttext.push(schema.oneOf.map(function(oneOf) {\n\t\t\treturn '* `' + subSchemas[oneOf['$ref']] + '`'\n\t\t}).join('\\n'))\n\t}\n\n\tif (schema.enum) {\n\t\ttext.push('This element must be one of the following enum values:');\n\t\ttext.push(schema.enum.map(function(enumItem) {\n\t\t\treturn '* `' + enumItem + '`'\n\t\t}).join('\\n'))\n\t}\n\n\tif (schema.default !== undefined) {\n\t\tif (schema.default === null || [ \"boolean\", \"number\", \"string\" ].indexOf(typeof schema.default) !== -1) {\n\t\t\ttext.push('Default: `' + JSON.stringify(schema.default) + '`')\n\t\t} else {\n\t\t\ttext.push('Default:')\n\t\t\ttext.push('```\\n' + JSON.stringify(schema.default, null, 2) + '\\n```')\n\t\t}\n\t}\n\n\tvar restrictions = generatePropertyRestrictions(schema)\n\n\tif (restrictions) {\n\t\ttext.push('Additional restrictions:')\n\t\ttext.push(restrictions)\n\t}\n\n\treturn text\n}\n\nfunction generatePropertySection(octothorpes, schema, subSchemas) {\n\tif (schema.properties) {\n\t\treturn Object.keys(schema.properties).map(function(propertyKey) {\n\t\t\tvar propertyIsRequired = schema.required && schema.required.indexOf(propertyKey) >= 0\n\t\t\treturn generateSchemaSectionText(octothorpes + '#', propertyKey, propertyIsRequired, schema.properties[propertyKey], subSchemas)\n\t\t})\n\t} else if (schema.oneOf) {\n\t\tvar oneOfList = schema.oneOf.map(function(innerSchema) {\n\n\t\t\treturn '* `' + getActualType(innerSchema, subSchemas) + '`'\n\t\t}).join('\\n')\n\t\treturn ['This property must be one of the following types:', oneOfList]\n\t} else {\n\t\treturn []\n\t}\n}\n\nfunction getActualType(schema, subSchemas) {\n\tif (schema.type) {\n\t\treturn schema.type\n\t} else if (schema['$ref'] && subSchemas[schema['$ref']]) {\n\t\treturn subSchemas[schema['$ref']]\n\t} else {\n\t\treturn undefined\n\t}\n}\n\nmodule.exports = function(schema, startingOctothorpes) {\n\tvar subSchemaTypes = Object.keys(schema.definitions || {}).reduce(function(map, subSchemaTypeName) {\n\t\tmap['#/definitions/' + subSchemaTypeName] = subSchemaTypeName\n\t\treturn map\n\t}, {})\n\n\tvar text = []\n\tvar octothorpes = startingOctothorpes || ''\n\n\tif (schema.title) {\n\t\toctothorpes += '#'\n\t\ttext.push(octothorpes + ' ' + schema.title)\n\t}\n\n\tif (schema.type === 'object') {\n\t\tif (schema.description) {\n\t\t\ttext.push(schema.description)\n\t\t}\n\t\ttext.push('The schema defines the following properties:')\n\t\tgeneratePropertySection(octothorpes, schema, subSchemaTypes).forEach(function(section) {\n\t\t\ttext = text.concat(section)\n\t\t})\n\t} else {\n\t\ttext = text.concat(generateSchemaSectionText('#' + octothorpes, undefined, false, schema, subSchemaTypes));\n\t}\n\n\tif (schema.definitions) {\n\t\ttext.push('---')\n\t\ttext.push('# Sub Schemas')\n\t\ttext.push('The schema defines the following additional types:')\n\t\tObject.keys(schema.definitions).forEach(function(subSchemaTypeName) {\n\t\t\ttext.push('## `' + subSchemaTypeName + '` (' + schema.definitions[subSchemaTypeName].type + ')')\n\t\t\ttext.push(schema.definitions[subSchemaTypeName].description)\n\t\t\tif (schema.definitions[subSchemaTypeName].type === 'object') {\n\t\t\t\tif (schema.definitions[subSchemaTypeName].properties) {\n\t\t\t\t\ttext.push('Properties of the `' + subSchemaTypeName + '` object:')\n\t\t\t\t}\n\t\t\t}\n\t\t\tgeneratePropertySection('##', schema.definitions[subSchemaTypeName], subSchemaTypes).forEach(function(section) {\n\t\t\t\ttext = text.concat(section)\n\t\t\t})\n\t\t})\n\t}\n\n\treturn text.filter(function(line) {\n\t\treturn !!line\n\t}).join('\\n\\n')\n}\n"]}