diff --git a/examples/docs/arrays.schema.md b/examples/docs/arrays.schema.md index a37f8cf68b639d3ff1e080a87de57bf0a529a363..86e4eb30df536b1f48a3b4e133b7660efaf19ee0 100644 --- a/examples/docs/arrays.schema.md +++ b/examples/docs/arrays.schema.md @@ -204,30 +204,15 @@ An array of simple objects Array type: `object[]` All items must be of the type: -Unknown type `object`. - -```json -{ - "type": "array", - "description": "An array of simple objects", - "items": { - "type": "object", - "properties": { - "a": { - "type": "string", - "description": "The a property" - }, - "b": { - "type": "integer", - "description": "The b property" - } - }, - "simpletype": "`object`" - }, - "simpletype": "`object[]`" -} -``` +`object` with following properties: + + +| Property | Type | Required +|----------|------|----------| +| `a`| string | **Required** | +| `b`| integer | Optional | +full list. diff --git a/examples/docs/deepextending.schema.md b/examples/docs/deepextending.schema.md index f80bd5a23230050fa873fccd70a23035b5b14b01..0221a913a5a127bd18526049c2e89077567c4ad9 100644 --- a/examples/docs/deepextending.schema.md +++ b/examples/docs/deepextending.schema.md @@ -46,7 +46,7 @@ An `id` with an `@` in front of it. The `@` stands for "dot com" `string` -* format: `uri-reference` URI Reference (according to [RFC3986](https://tools.ietf.org/html/rfc3986)) +* format: `uri-reference` – URI Reference (according to [RFC3986](https://tools.ietf.org/html/rfc3986)) @@ -141,7 +141,7 @@ A unique identifier given to every addressable thing. `string` -* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) +* format: `uri` – Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) @@ -161,7 +161,7 @@ An about ids. It is meta. If you are confused, send an email to the address spec `string` -* format: `email` email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) +* format: `email` – email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 734c3a3bed27b0d407c3cb46f5089bdd2bb711a9..3b73086243bf667dcfcf1e81b1b9a954dbc9476c 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -50,7 +50,7 @@ An `id` with an `@` in front of it. The `@` stands for "dot com" `string` -* format: `uri-reference` URI Reference (according to [RFC3986](https://tools.ietf.org/html/rfc3986)) +* format: `uri-reference` – URI Reference (according to [RFC3986](https://tools.ietf.org/html/rfc3986)) @@ -70,7 +70,7 @@ A unique identifier given to every addressable thing. `string` -* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) +* format: `uri` – Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) @@ -90,7 +90,7 @@ An about ids. It is meta. If you are confused, send an email to the address spec `string` -* format: `email` email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) +* format: `email` – email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) diff --git a/examples/docs/extending.schema.md b/examples/docs/extending.schema.md index f6d701c08c68df09e05355ecf4c4fbf5b9fb0550..141f23403f6d9583d09103dfb9eceb838d696284 100644 --- a/examples/docs/extending.schema.md +++ b/examples/docs/extending.schema.md @@ -44,7 +44,7 @@ An `id` with an `@` in front of it. The `@` stands for "dot com" `string` -* format: `uri-reference` URI Reference (according to [RFC3986](https://tools.ietf.org/html/rfc3986)) +* format: `uri-reference` – URI Reference (according to [RFC3986](https://tools.ietf.org/html/rfc3986)) @@ -120,7 +120,7 @@ A unique identifier given to every addressable thing. `string` -* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) +* format: `uri` – Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) @@ -140,7 +140,7 @@ An about ids. It is meta. If you are confused, send an email to the address spec `string` -* format: `email` email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) +* format: `email` – email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) diff --git a/examples/docs/simple.schema.md b/examples/docs/simple.schema.md index 922088cfa15af07d1d2885969bc38cd15659738f..bdaa1eaebdfbeebd5e0e74e4aeacb1ec075e118a 100644 --- a/examples/docs/simple.schema.md +++ b/examples/docs/simple.schema.md @@ -34,7 +34,7 @@ A unique identifier given to every addressable thing. `string` -* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) +* format: `uri` – Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) diff --git a/examples/docs/simpletypes.schema.md b/examples/docs/simpletypes.schema.md index 1aefdca19c4faab04eda5051b785de0eb5ffbffb..00b71c29e79d5648f42cbbf59eef755b6e0f547f 100644 --- a/examples/docs/simpletypes.schema.md +++ b/examples/docs/simpletypes.schema.md @@ -148,7 +148,7 @@ A date-like string. `string` -* format: `date-time` date and time (according to [RFC 3339, section 5.6](http://tools.ietf.org/html/rfc3339)) +* format: `date-time` – date and time (according to [RFC 3339, section 5.6](http://tools.ietf.org/html/rfc3339)) @@ -168,7 +168,7 @@ An email-like string. `string` -* format: `email` email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) +* format: `email` – email address (according to [RFC 5322, section 3.4.1](https://tools.ietf.org/html/rfc5322)) @@ -188,7 +188,7 @@ A hostname-like string. `string` -* format: `hostname` Domain Name (according to [RFC 1034, section 3.1](https://tools.ietf.org/html/rfc1034)) +* format: `hostname` – Domain Name (according to [RFC 1034, section 3.1](https://tools.ietf.org/html/rfc1034)) @@ -208,7 +208,7 @@ An IPv4-like string. `string` -* format: `ipv4` IP (v4) address (according to [RFC 2673, section 3.2](https://tools.ietf.org/html/rfc2673)) +* format: `ipv4` – IP (v4) address (according to [RFC 2673, section 3.2](https://tools.ietf.org/html/rfc2673)) @@ -228,7 +228,7 @@ An IPv6-like string. `string` -* format: `ipv6` IP (v6) address (according to [RFC 4291, section 2.2](https://tools.ietf.org/html/rfc4291)) +* format: `ipv6` – IP (v6) address (according to [RFC 4291, section 2.2](https://tools.ietf.org/html/rfc4291)) @@ -418,7 +418,7 @@ A URI. `string` -* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) +* format: `uri` – Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) diff --git a/examples/docs/subdir/subdir.schema.md b/examples/docs/subdir/subdir.schema.md index 5e236c39600ee4d2d57c83fa656f1a2b1c2a3934..b62f2221165f124ee876146218c7603fa77ea098 100644 --- a/examples/docs/subdir/subdir.schema.md +++ b/examples/docs/subdir/subdir.schema.md @@ -34,7 +34,7 @@ A unique identifier given to every addressable thing. `string` -* format: `uri` Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) +* format: `uri` – Uniformous Resource Identifier (according to [RFC3986](http://tools.ietf.org/html/rfc3986)) diff --git a/examples/generated-schemas/arrays.schema.json b/examples/generated-schemas/arrays.schema.json index 42200b11881d8e45de4408c16596de2d2cbc06c0..490e0e05ba5730829ed65b69e446549ada706774 100644 --- a/examples/generated-schemas/arrays.schema.json +++ b/examples/generated-schemas/arrays.schema.json @@ -82,6 +82,9 @@ "description": "An array of simple objects", "items": { "type": "object", + "required": [ + "a" + ], "properties": { "a": { "type": "string", diff --git a/examples/schemas/arrays.schema.json b/examples/schemas/arrays.schema.json index 2d9bb704e7b4c4ee008f8952cd77720c90118658..9cc2660f110157c7de7e3306fb275da85cde571e 100644 --- a/examples/schemas/arrays.schema.json +++ b/examples/schemas/arrays.schema.json @@ -82,6 +82,9 @@ "description": "An array of simple objects", "items": { "type": "object", + "required": [ + "a" + ], "properties": { "a": { "type": "string", diff --git a/templates/md/nested-properties.ejs b/templates/md/nested-properties.ejs new file mode 100644 index 0000000000000000000000000000000000000000..66143c027698e7efbd59d351602f9e9dcd90daf3 --- /dev/null +++ b/templates/md/nested-properties.ejs @@ -0,0 +1,16 @@ +<% /** + * Copyright 2017 Adobe Systems Incorporated. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * 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 + */ %> + + +| Property | Type | Required +|----------|------|----------| +<% _.keys(props).sort().forEach(property => { + const schema = props[property]; %> +| `<%= property %>`| <%= schema.type %> | <%= (outer.required&&outer.required.indexOf(property)>=0) ? "**Required**" : "Optional" %> | +<% +}); +%> \ No newline at end of file diff --git a/templates/md/object-type.ejs b/templates/md/object-type.ejs new file mode 100644 index 0000000000000000000000000000000000000000..4addd6aa852347a35f79fb901a9958c1f081247a --- /dev/null +++ b/templates/md/object-type.ejs @@ -0,0 +1,12 @@ +<% /** + * Copyright 2018 Adobe Systems Incorporated. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * 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 + */ %> + +`object` with following properties: + +<%- include("nested-properties",{outer:schema,props: schema.properties,_:_, nested:true}) %> + +full list. \ No newline at end of file