Skip to content

Commit b4b8855

Browse files
committed
fix(markdown): catch error when using title as a property name
1 parent 2878221 commit b4b8855

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/markdownBuilder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ function build({
414414
})();
415415

416416
const typelink = (() => {
417-
if (definition[keyword`title`]) {
417+
if (definition[keyword`title`] && typeof definition[keyword`title`] === 'string') {
418418
// if the type has a title, always create a link to the schema
419419
return [text(' ('), link(`${definition[s.slug]}.md`, '', text(definition[keyword`title`])), text(')')];
420420
} else if (!singletype || firsttype === keyword`object` || merged) {

test/markdownBuilder.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ describe('Testing Markdown Builder: title', () => {
7575
assertMarkdown(results.meta)
7676
.fuzzy`defined in: [Meta](meta-definitions-meta-properties-title.md "https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/title")`;
7777
});
78+
79+
it('Title Schema looks OK', () => {
80+
assertMarkdown(results['meta-definitions-meta-properties'])
81+
.fuzzy`properties Type`;
82+
});
7883
});
7984

8085
describe('Testing Markdown Builder: enums', () => {

0 commit comments

Comments
 (0)