Skip to content

Commit

Permalink
fix(markdown): catch error when using title as a property name
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Jan 14, 2020
1 parent 2878221 commit b4b8855
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/markdownBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ function build({
})();

const typelink = (() => {
if (definition[keyword`title`]) {
if (definition[keyword`title`] && typeof definition[keyword`title`] === 'string') {
// if the type has a title, always create a link to the schema
return [text(' ('), link(`${definition[s.slug]}.md`, '', text(definition[keyword`title`])), text(')')];
} else if (!singletype || firsttype === keyword`object` || merged) {
Expand Down
5 changes: 5 additions & 0 deletions test/markdownBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ describe('Testing Markdown Builder: title', () => {
assertMarkdown(results.meta)
.fuzzy`defined in: [Meta](meta-definitions-meta-properties-title.md "https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/title")`;
});

it('Title Schema looks OK', () => {
assertMarkdown(results['meta-definitions-meta-properties'])
.fuzzy`properties Type`;
});
});

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

0 comments on commit b4b8855

Please sign in to comment.