diff --git a/lib/markdownBuilder.js b/lib/markdownBuilder.js index b4839ba8..25119c70 100644 --- a/lib/markdownBuilder.js +++ b/lib/markdownBuilder.js @@ -587,14 +587,14 @@ function build({ constraints.push(paragraph([link(`https://regexr.com/?expression=${encodeURIComponent(schema[keyword`pattern`])}`, i18n`try regular expression with regexr.com`, text(i18n`try pattern`))])); } // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.3 - if (schema.format && formats[schema.format]) { + if (schema.format && typeof schema.format === 'string' && formats[schema.format]) { constraints.push(paragraph([ strong(text(formats[keyword([schema.format])].label)), text(': '), text(formats[schema.format].text), link(formats[schema.format].speclink, i18n`check the specification`, text(formats[schema.format].specname)), ])); - } else if (schema.format) { + } else if (schema.format && typeof schema.format === 'string') { constraints.push(paragraph([strong(text(i18n`unknown format`)), text(': '), text(i18n`the value of this string must follow the format: `), inlineCode(String(schema.format))])); } diff --git a/test/markdownBuilder.test.js b/test/markdownBuilder.test.js index 17add866..63680ffe 100644 --- a/test/markdownBuilder.test.js +++ b/test/markdownBuilder.test.js @@ -92,8 +92,8 @@ describe('Testing Markdown Builder: format', () => { }); it('Format Schema looks OK', () => { - assertMarkdown(results.properties) - .fuzzy`defined in: [Meta](meta-definitions-meta-properties-title.md "https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/title")`; + assertMarkdown(results.format) + .fuzzy`Formatting used to display the date.`; }); });