From 22fdfa83f015ee3f7540e2debc61af25d611784f Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Wed, 13 Dec 2017 19:14:36 +0000 Subject: [PATCH] #7 highlight extensible schemas --- examples/docs/abstract.schema.md | 2 +- examples/docs/definitions.schema.md | 2 +- examples/docs/example.schema.md | 2 +- examples/docs/extensible.schema.md | 2 +- examples/docs/simple.schema.md | 2 +- examples/docs/subdir/subdir.schema.md | 2 +- lib/markdownWriter.js | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index 842df19..c035b2e 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -13,5 +13,5 @@ This is an abstract schema. It has `definitions`, but does not declare any prope | Abstract | Extensible | Custom Properties | Defined In | |----------|------------|-------------------|------------| -| true | true | true | [abstract.schema.json](abstract.schema.json) | +| Cannot be instantiated | Is extensible | true | [abstract.schema.json](abstract.schema.json) | --- \ No newline at end of file diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 5bebd8a..cc35ca4 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -14,5 +14,5 @@ It is imported using `allOf` and `$ref`. | Abstract | Extensible | Custom Properties | Defined In | |----------|------------|-------------------|------------| -| false | true | true | [definitions.schema.json](definitions.schema.json) | +| Can be instantiated | Is extensible | true | [definitions.schema.json](definitions.schema.json) | --- \ No newline at end of file diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md index a9d0955..add444b 100644 --- a/examples/docs/example.schema.md +++ b/examples/docs/example.schema.md @@ -13,5 +13,5 @@ This is an example schema with examples. Too many examples? There can never be t | Abstract | Extensible | Custom Properties | Defined In | |----------|------------|-------------------|------------| -| false | false | true | [example.schema.json](example.schema.json) | +| Can be instantiated | Is not extensible | true | [example.schema.json](example.schema.json) | --- \ No newline at end of file diff --git a/examples/docs/extensible.schema.md b/examples/docs/extensible.schema.md index 35d1e74..1056513 100644 --- a/examples/docs/extensible.schema.md +++ b/examples/docs/extensible.schema.md @@ -13,5 +13,5 @@ This is an extensible schema. It has `definitions`, that can be used in other sc | Abstract | Extensible | Custom Properties | Defined In | |----------|------------|-------------------|------------| -| true | true | true | [extensible.schema.json](extensible.schema.json) | +| Cannot be instantiated | Is extensible | true | [extensible.schema.json](extensible.schema.json) | --- \ No newline at end of file diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md index 71311cf..af3cf5b 100644 --- a/examples/docs/simple.schema.md +++ b/examples/docs/simple.schema.md @@ -13,5 +13,5 @@ This is a *very* simple example of a JSON schema. There is only one property. | Abstract | Extensible | Custom Properties | Defined In | |----------|------------|-------------------|------------| -| false | false | true | [simple.schema.json](simple.schema.json) | +| Can be instantiated | Is not extensible | true | [simple.schema.json](simple.schema.json) | --- \ No newline at end of file diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index 4f05fda..73c5fcf 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -13,5 +13,5 @@ A schema in a sub directory | Abstract | Extensible | Custom Properties | Defined In | |----------|------------|-------------------|------------| -| true | true | true | [subdir/subdir.schema.json](subdir/subdir.schema.json) | +| Cannot be instantiated | Is extensible | true | [subdir/subdir.schema.json](subdir/subdir.schema.json) | --- \ No newline at end of file diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 9d70def..79f2a78 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -33,8 +33,8 @@ function schemaProps(schema, schemaPath, filename) { console.log(_.keys(schema)); return { // if there are definitions, but no properties - abstract: schema.definitions !== undefined && _.keys(schema.properties).length === 0, - extensible: schema.definitions !== undefined || schema['meta:extensible'] === true, + abstract: (schema.definitions !== undefined && _.keys(schema.properties).length === 0) ? 'Cannot be instantiated' : 'Can be instantiated', + extensible: (schema.definitions !== undefined || schema['meta:extensible'] === true) ? 'Yes' : 'No', custom: true, original: filename.substr(schemaPath.length).substr(1), }; -- GitLab