From bd86be6838fde41fea2503946efaaf2c00503136 Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Wed, 13 Dec 2017 18:36:32 +0000 Subject: [PATCH] #14 include description --- examples/docs/abstract.schema.md | 4 ++++ examples/docs/definitions.schema.md | 5 +++++ examples/docs/example.schema.md | 4 ++++ examples/docs/simple.schema.md | 4 ++++ examples/docs/subdir/subdir.schema.md | 4 ++++ lib/markdownWriter.js | 2 +- templates/md/header.ejs | 7 ++++++- 7 files changed, 28 insertions(+), 2 deletions(-) diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index d43412e..2433c8b 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -5,4 +5,8 @@ foo: bar --- # Abstract +``` +https://example.com/schemas/abstract +``` +This is an abstract schema. It has `definitions`, but does not declare any properties --- \ No newline at end of file diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 5001818..c942cb0 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -5,4 +5,9 @@ foo: bar --- # Definitions +``` +https://example.com/schemas/definitions +``` +This is an example of using a `definitions` object within a schema. +It is imported using `allOf` and `$ref`. --- \ No newline at end of file diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md index c25446a..19bb89f 100644 --- a/examples/docs/example.schema.md +++ b/examples/docs/example.schema.md @@ -5,4 +5,8 @@ foo: bar --- # Example +``` +https://example.com/schemas/example +``` +This is an example schema with examples. Too many examples? There can never be too many examples! --- \ No newline at end of file diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md index 61036aa..6c8eddb 100644 --- a/examples/docs/simple.schema.md +++ b/examples/docs/simple.schema.md @@ -5,4 +5,8 @@ foo: bar --- # Simple +``` +https://example.com/schemas/simple +``` +This is a *very* simple example of a JSON schema. There is only one property. --- \ No newline at end of file diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index 0f2cb03..865b6eb 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -5,4 +5,8 @@ foo: bar --- # Subdir +``` +https://example.com/schemas/subdir/subdir +``` +A schema in a sub directory --- \ No newline at end of file diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 5dc91d6..c98c552 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -44,7 +44,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen // one huge template, each block can be built individually const multi = [ [ 'frontmatter.ejs', { meta: schema.metaElements } ], - [ 'header.ejs', { title: schema.title } ], + [ 'header.ejs', { schema: schema } ], //[ 'divider.ejs', null ], //[ 'topSchema.ejs', ctx ], [ 'divider.ejs', null ] diff --git a/templates/md/header.ejs b/templates/md/header.ejs index 837be32..a49eeed 100644 --- a/templates/md/header.ejs +++ b/templates/md/header.ejs @@ -4,4 +4,9 @@ * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 */ %> -# <%=title %> \ No newline at end of file +# <%=schema.title %> +``` +<%= schema.$id %> +``` + +<%= schema.description %> \ No newline at end of file -- GitLab