From b984cf8d3ce4063ae750a4423218cbd83f2105d1 Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Thu, 14 Dec 2017 16:45:09 +0000 Subject: [PATCH] [trivial] include definition group --- examples/docs/abstract.schema.md | 8 ++++---- examples/docs/extensible.schema.md | 8 ++++---- examples/docs/subdir/subdir.schema.md | 6 +++--- lib/markdownWriter.js | 1 + templates/md/definitions.ejs | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index d233ffd..8782a9d 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -17,10 +17,10 @@ This is an abstract schema. It has `definitions`, but does not declare any prope # Abstract Definitions -| Property | Type | -|----------|------| -| [foo](#foo) | `string` | -| [bar](#bar) | `string` | +| Property | Type | Group | +|----------|------|-------| +| [foo](#foo) | `string` | `#/definitions/first` | +| [bar](#bar) | `string` | `#/definitions/second` | ## foo diff --git a/examples/docs/extensible.schema.md b/examples/docs/extensible.schema.md index 7c9a325..889086f 100644 --- a/examples/docs/extensible.schema.md +++ b/examples/docs/extensible.schema.md @@ -17,10 +17,10 @@ This is an extensible schema. It has `definitions`, that can be used in other sc # Extensible Definitions -| Property | Type | -|----------|------| -| [foo](#foo) | `string` | -| [bar](#bar) | `string` | +| Property | Type | Group | +|----------|------|-------| +| [foo](#foo) | `string` | `#/definitions/first` | +| [bar](#bar) | `string` | `#/definitions/second` | ## foo diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index 4f00d1f..53dfc8c 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -17,9 +17,9 @@ A schema in a sub directory # Subdir Definitions -| Property | Type | -|----------|------| -| [id](#id) | `string` | +| Property | Type | Group | +|----------|------|-------| +| [id](#id) | `string` | `#/definitions/content` | ## id diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 4b9529c..622476b 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -175,6 +175,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen const property = definition[_.keys(definition)[j]]; //console.log('Checking ' + name + ' against ' + _.keys(schema.properties)); if (_.keys(schema.properties).indexOf(name)===-1) { + property.definitiongroup = _.keys(schema.definitions)[i]; abstract[name] = property; } } diff --git a/templates/md/definitions.ejs b/templates/md/definitions.ejs index 4b02955..3c15918 100644 --- a/templates/md/definitions.ejs +++ b/templates/md/definitions.ejs @@ -8,8 +8,8 @@ -| Property | Type | -|----------|------| +| Property | Type | Group | +|----------|------|-------| <% _.forIn(props, (schema, property, object) => { %> -| [<%= property %>](#<%= property %>) | <%= schema.simpletype %> | +| [<%= property %>](#<%= property %>) | <%= schema.simpletype %> | `#/definitions/<%= schema.definitiongroup %>` | <% }); %> \ No newline at end of file -- GitLab