diff --git a/examples/docs/abstract.schema.md b/examples/docs/abstract.schema.md index 5fb46d7b3382936e2184cbd349ba744b3659bae9..72799baabf2228ab2a292ab3ba9cfc0fda2a5354 100644 --- a/examples/docs/abstract.schema.md +++ b/examples/docs/abstract.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/abstract This is an abstract schema. It has `definitions`, but does not declare any properties -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Cannot be instantiated | Yes | Forbidden | [abstract.schema.json](abstract.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Cannot be instantiated | Yes | Forbidden | Permitted | [abstract.schema.json](abstract.schema.json) | # Abstract Definitions diff --git a/examples/docs/arrays.schema.md b/examples/docs/arrays.schema.md index 5b8b85ebf0efa59ab709d173155d65e07589e815..33a352c0bb17cdc1b8960d26c2e09363803fa11b 100644 --- a/examples/docs/arrays.schema.md +++ b/examples/docs/arrays.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/arrays This is an example schema with examples for multiple array types and their constraints. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [arrays.schema.json](arrays.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [arrays.schema.json](arrays.schema.json) | # Arrays Properties diff --git a/examples/docs/complex.schema.md b/examples/docs/complex.schema.md index f7de9cfce6d409ac2ad335f8c3e373079fce76b1..bf4b714208af5cf957f35c791b52f4c24232fa15 100644 --- a/examples/docs/complex.schema.md +++ b/examples/docs/complex.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/complex This is an example schema that uses types defined in other schemas. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [complex.schema.json](complex.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Forbidden | [complex.schema.json](complex.schema.json) | ## Schema Hierarchy @@ -31,6 +31,7 @@ This is an example schema that uses types defined in other schemas. | [reflist](#reflist) | Simple | Optional | Complex References (this schema) | | [refnamed](#refnamed) | Simple | Optional | Complex References (this schema) | | [xor](#xor) | complex | Optional | Complex References (this schema) | +| `*` | `any` | Optional | this schema *allows* additional properties | ## and diff --git a/examples/docs/constants.schema.md b/examples/docs/constants.schema.md index 518253c7162fa71fb9c4c6f508bceb88966b7af3..8c4ef921811587418caa8f721aba699d934db2b0 100644 --- a/examples/docs/constants.schema.md +++ b/examples/docs/constants.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/constants This is an example schema with examples for properties with constant values -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [constants.schema.json](constants.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [constants.schema.json](constants.schema.json) | # Constant Types Properties diff --git a/examples/docs/custom.schema.md b/examples/docs/custom.schema.md index de9cb6407c61cdf2df4739d02e124506171e081e..c6561e07f829c4367d6970206df34cd26d6012ae 100644 --- a/examples/docs/custom.schema.md +++ b/examples/docs/custom.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/custom This is an extensible schema. It has `definitions`, that can be used in other schemas. Additionally, it allows custom properties. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | Yes | Allowed | [custom.schema.json](custom.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | Yes | Allowed | Permitted | [custom.schema.json](custom.schema.json) | # Custom Properties diff --git a/examples/docs/deepextending.schema.md b/examples/docs/deepextending.schema.md index 0221a913a5a127bd18526049c2e89077567c4ad9..58b747269fa93ed6f48d0cf489d7ae57ddd3ae57 100644 --- a/examples/docs/deepextending.schema.md +++ b/examples/docs/deepextending.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/deepextending This is an extending schema. It is extending another extending schema. It pulls `definitions` from other schemas. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | Yes | Forbidden | [deepextending.schema.json](deepextending.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | Yes | Forbidden | Permitted | [deepextending.schema.json](deepextending.schema.json) | ## Schema Hierarchy diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 3b73086243bf667dcfcf1e81b1b9a954dbc9476c..7c63cbe90f4b25dcdf55446b75637991c9a0a30e 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -25,9 +25,9 @@ Bre- aks. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | Yes | Forbidden | [definitions.schema.json](definitions.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | Yes | Forbidden | Permitted | [definitions.schema.json](definitions.schema.json) | # Definitions Properties diff --git a/examples/docs/enums.schema.md b/examples/docs/enums.schema.md index d3d0ded4239c726f1d608b272159e6853420bb19..338ad01de217e50018ea3c496d67e00705f2c5ae 100644 --- a/examples/docs/enums.schema.md +++ b/examples/docs/enums.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/enums This is an example schema with examples for properties with enum values -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [enums.schema.json](enums.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [enums.schema.json](enums.schema.json) | # Enumerated Properties diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md index a72db9642b4c76dc940a22c9f4a32a4e4cd34ec8..8fff9dcf9f5aa977f7a05a52e524caa757f575bf 100644 --- a/examples/docs/example.schema.md +++ b/examples/docs/example.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/example This is an example schema with examples. Too many examples? There can never be too many examples! -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [example.schema.json](example.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [example.schema.json](example.schema.json) | ## Example Example ```json diff --git a/examples/docs/examples.schema.md b/examples/docs/examples.schema.md index 6195d44b6c2389924900749ac2055f2d93a47515..68cfc6fa1d0f6b6facc45c1b6f73440878015806 100644 --- a/examples/docs/examples.schema.md +++ b/examples/docs/examples.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/examples This is an example schema with *multiple* examples. Too many examples? There can never be too many examples! -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [examples.schema.json](examples.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [examples.schema.json](examples.schema.json) | ## Examples Examples diff --git a/examples/docs/extending.schema.md b/examples/docs/extending.schema.md index 141f23403f6d9583d09103dfb9eceb838d696284..2643d90a6fd2eb53cbea11c8498fe7d70acce988 100644 --- a/examples/docs/extending.schema.md +++ b/examples/docs/extending.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/extending This is an extending schema. It pulls `definitions` from other schemas. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | Yes | Forbidden | [extending.schema.json](extending.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | Yes | Forbidden | Permitted | [extending.schema.json](extending.schema.json) | ## Schema Hierarchy diff --git a/examples/docs/extensible.schema.md b/examples/docs/extensible.schema.md index d0f9c80ce4132cde0a7005df35d418922613393e..2c7b0eb858b22b9c24bf6d94f2b9e61d3c31aac8 100644 --- a/examples/docs/extensible.schema.md +++ b/examples/docs/extensible.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/extensible This is an extensible schema. It has `definitions`, that can be used in other schemas -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Cannot be instantiated | Yes | Forbidden | [extensible.schema.json](extensible.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Cannot be instantiated | Yes | Forbidden | Permitted | [extensible.schema.json](extensible.schema.json) | # Extensible Definitions diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md index bdaa1eaebdfbeebd5e0e74e4aeacb1ec075e118a..8669734e1c82e9876d4dcdb349ba1ade21089536 100644 --- a/examples/docs/simple.schema.md +++ b/examples/docs/simple.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/simple This is a *very* simple example of a JSON schema. There is only one property. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [simple.schema.json](simple.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [simple.schema.json](simple.schema.json) | # Simple Properties diff --git a/examples/docs/simpletypes.schema.md b/examples/docs/simpletypes.schema.md index 00b71c29e79d5648f42cbbf59eef755b6e0f547f..92351c264f0ddf71fb2cb124ad6e8c98dcf65afd 100644 --- a/examples/docs/simpletypes.schema.md +++ b/examples/docs/simpletypes.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/simpletypes This is an example schema with examples for multiple types and their constraints. -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Can be instantiated | No | Forbidden | [simpletypes.schema.json](simpletypes.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Can be instantiated | No | Forbidden | Permitted | [simpletypes.schema.json](simpletypes.schema.json) | # Simple Types Properties diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index b62f2221165f124ee876146218c7603fa77ea098..ab876d4ea430ad6eb77bfd574b0da0234abdc632 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -11,9 +11,9 @@ https://example.com/schemas/subdir/subdir A schema in a sub directory -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| Cannot be instantiated | Yes | Forbidden | [subdir/subdir.schema.json](subdir/subdir.schema.json) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| Cannot be instantiated | Yes | Forbidden | Permitted | [subdir/subdir.schema.json](subdir/subdir.schema.json) | # Subdir Definitions diff --git a/examples/generated-schemas/complex.schema.json b/examples/generated-schemas/complex.schema.json index ffab75e0a25cb59c87777e2ef4161fe6ae7b788d..bfac128abc787e408bad3150388b17abfb1d36e2 100644 --- a/examples/generated-schemas/complex.schema.json +++ b/examples/generated-schemas/complex.schema.json @@ -64,5 +64,6 @@ }, "required": [ "refabstract" - ] + ], + "additionalProperties": true } \ No newline at end of file diff --git a/examples/schemas/complex.schema.json b/examples/schemas/complex.schema.json index 53eb440bcca9bdb26a9aefe16090ad67d0574dfc..1ed3314059d03f74f34243ca2addb84351154fcf 100644 --- a/examples/schemas/complex.schema.json +++ b/examples/schemas/complex.schema.json @@ -47,5 +47,6 @@ }, "required": [ "refabstract" - ] + ], + "additionalProperties": true } diff --git a/lib/markdownWriter.js b/lib/markdownWriter.js index 8cd6a39eda5dc02f522f051843fea878f147b33f..6ce3a90ac67dcdba2cac4d10865814d35aa042d0 100644 --- a/lib/markdownWriter.js +++ b/lib/markdownWriter.js @@ -172,7 +172,7 @@ const generateMarkdown = function(filename, schema, schemaPath, outDir, dependen ]; if (_.keys(schema.properties).length > 0) { - multi.push([ 'properties.ejs', { props: requiredProperties(schema.properties, schema.required), title: schema.title } ]); + multi.push([ 'properties.ejs', { props: requiredProperties(schema.properties, schema.required), title: schema.title, additional: schema.additionalProperties } ]); for (let i=0; i<_.keys(schema.properties).length;i++) { const name = _.keys(schema.properties).sort()[i]; multi.push( [ 'property.ejs', { diff --git a/templates/md/header.ejs b/templates/md/header.ejs index 56d68abdeef92548ad200a504acf2d3fea2b6838..1871e1b340e5ecb9a71c09f69d21bcf2f0f850dd 100644 --- a/templates/md/header.ejs +++ b/templates/md/header.ejs @@ -16,9 +16,9 @@ -| Abstract | Extensible | Custom Properties | Defined In | -|----------|------------|-------------------|------------| -| <%=props.abstract %> | <%=props.extensible %> | <%=props.custom %> | [<%=props.original %>](<%=props.original %>) | +| Abstract | Extensible | Custom Properties | Additional Properties | Defined In | +|----------|------------|-------------------|-----------------------|------------| +| <%=props.abstract %> | <%=props.extensible %> | <%=props.custom %> | <%= schema.additionalProperties===true ? "Forbidden" : "Permitted" %> | [<%=props.original %>](<%=props.original %>) | <% if (dependencies.length > 0) { %> ## Schema Hierarchy diff --git a/templates/md/properties.ejs b/templates/md/properties.ejs index 0a52119b71c8a5d916e6f1efb308e6b79d9cf316..f2487748dcb67c43afe5b19bf69261678b6b2769 100644 --- a/templates/md/properties.ejs +++ b/templates/md/properties.ejs @@ -18,4 +18,6 @@ %><%= title %> (this schema)<% } %> | <% }); -%> \ No newline at end of file +%><% if (additional) { %> +| `*` | `any` | Optional | this schema *allows* additional properties | +<% } %> \ No newline at end of file