diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index 43aff6dc7d83a37f53fc342063e5b0b1beecab1c..d233ffd7f15fc6bae99fb201e2b5bed9942d89d3 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -21,3 +21,41 @@ This is an abstract schema. It has `definitions`, but does not declare any prope |----------|------| | [foo](#foo) | `string` | | [bar](#bar) | `string` | + +## foo + +A unique identifier given to every addressable thing. + +`foo` +* is optional +* type: `string` +* defined in this schema + +### foo Type + + +`string` + + + + + + +## bar + +A unique identifier given to every addressable thing. + +`bar` +* is optional +* type: `string` +* defined in this schema + +### bar Type + + +`string` + + + + + diff --git a/examples/docs/extensible.schema.md b/examples/docs/extensible.schema.md index d685f950b2db50115c666916c16fc142af716919..7c9a325156075d2eb1ac781f8340771bdccd1745 100644 --- a/examples/docs/extensible.schema.md +++ b/examples/docs/extensible.schema.md @@ -21,3 +21,58 @@ This is an extensible schema. It has `definitions`, that can be used in other sc |----------|------| | [foo](#foo) | `string` | | [bar](#bar) | `string` | + +## foo + +A unique identifier given to every addressable thing. + +`foo` +* is optional +* type: `string` +* defined in this schema + +### foo Type + + +`string` + + + + + +### foo Example + +```json +"bar" +``` + + +## bar + +A horse walks into it. + +`bar` +* is optional +* type: `string` +* defined in this schema + +### bar Type + + +`string` + + + + + +### bar Examples + +```json +"whoo" +``` + +```json +"hoo" +``` + + diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index c7dc9e8c1f78997aa09a93bab8f3f4a0f68c388f..4f00d1f0c63b1a69263e0a5010b7dce51a2d2529 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -20,3 +20,23 @@ A schema in a sub directory | Property | Type | |----------|------| | [id](#id) | `string` | + +## id + +A unique identifier given to every addressable thing. + +`id` +* is optional +* type: `string` +* defined in this schema + +### id Type + + +`string` +* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) + + + + + diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 31e217b1514aadd1d2c82f58137f7e2d52226afb..4b9529cfc1e3428e16a9164a1ee635d5f8db1acc 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -164,7 +164,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen schema: simpletype(schema.properties[_.keys(schema.properties)[i]]) } ]); } } - + //find definitions that contain properties that are not part of the main schema if (_.keys(schema.definitions).length > 0) { const abstract = {}; for (let i=0; i<_.keys(schema.definitions).length;i++) { @@ -181,8 +181,15 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen } } if (_.keys(abstract).length>0) { - console.log('I got definitions!', abstract); + //console.log('I got definitions!', abstract); multi.push([ 'definitions.ejs', { props: requiredProperties(abstract), title: schema.title } ]); + for (let i=0; i<_.keys(abstract).length;i++) { + multi.push( [ 'property.ejs', { + name: _.keys(abstract)[i], + required: false, + examples: stringifyExamples(abstract[_.keys(abstract)[i]]['examples']), + schema: simpletype(abstract[_.keys(abstract)[i]]) } ]); + } } }