diff --git a/examples/docs/arrays.schema.md b/examples/docs/arrays.schema.md index ba5db9f91767002c08d99b3c736f3be61dbc4175..7cccea88d36a7398c8e982c1ae2d639b5630f879 100644 --- a/examples/docs/arrays.schema.md +++ b/examples/docs/arrays.schema.md @@ -38,19 +38,14 @@ This is an array ### list Type -Unknown type `array`. - -```json -{ - "type": "array", - "description": "This is an array", - "items": { - "type": "string", - "simpletype": "`string`" - }, - "simpletype": "`string[]`" -} -``` + +Array type: `string[]`. + +All items must be of the type: +`string` + + + @@ -68,19 +63,15 @@ This is an array of arrays ### listlist Type -Unknown type `array`. - -```json -{ - "type": "array", - "description": "This is an array of arrays", - "items": { - "type": "array", - "simpletype": "`array`" - }, - "simpletype": "`array[]`" -} -``` + +Array type: `array[]`. + +All items must be of the type: +Nesting alarm! + +Array type: `array`. + + @@ -98,23 +89,21 @@ This is an array of arrays of strings ### stringlistlist Type -Unknown type `array`. - -```json -{ - "type": "array", - "description": "This is an array of arrays of strings", - "items": { - "type": "array", - "items": { - "type": "string", - "simpletype": "`string`" - }, - "simpletype": "`string[]`" - }, - "simpletype": "`string[][]`" -} -``` + +Array type: `string[][]`. + +All items must be of the type: +Nesting alarm! + +Array type: `string[]`. + +All items must be of the type: +`string` + + + + + @@ -132,21 +121,14 @@ This is an array ### intlist Type -Unknown type `array`. - -```json -{ - "type": "array", - "description": "This is an array", - "items": { - "type": "integer", - "simpletype": "`integer`" - }, - "maxItems": 10, - "minItems": 1, - "simpletype": "`integer[]`" -} -``` + +Array type: `integer[]`. + +All items must be of the type: +`integer` + + + @@ -164,20 +146,12 @@ This is an array ### boollist Type -Unknown type `array`. - -```json -{ - "type": "array", - "description": "This is an array", - "items": { - "type": "boolean", - "simpletype": "`boolean`" - }, - "minItems": 1, - "simpletype": "`boolean[]`" -} -``` + +Array type: `boolean[]`. + +All items must be of the type: +`boolean` + @@ -195,20 +169,14 @@ This is an array ### numlist Type -Unknown type `array`. - -```json -{ - "type": "array", - "description": "This is an array", - "items": { - "type": "number", - "simpletype": "`number`" - }, - "maxItems": 10, - "simpletype": "`number[]`" -} -``` + +Array type: `number[]`. + +All items must be of the type: +`number` +* minimum value: `10` + + diff --git a/examples/generated-schemas/arrays.schema.json b/examples/generated-schemas/arrays.schema.json index 6110c8e985d6724ff4a4d260b11e9f748c3f7a39..a6707af609452a1f49d3d2c8471c887a3130fe89 100644 --- a/examples/generated-schemas/arrays.schema.json +++ b/examples/generated-schemas/arrays.schema.json @@ -56,7 +56,8 @@ "type": "array", "description": "This is an array", "items": { - "type": "number" + "type": "number", + "minimum": 10 }, "maxItems": 10 } diff --git a/examples/schemas/arrays.schema.json b/examples/schemas/arrays.schema.json index ad781887412b1f369aa15528d425f475fbe2b4b7..26e0cad697735bea34878cf428e6e6e750d541d8 100644 --- a/examples/schemas/arrays.schema.json +++ b/examples/schemas/arrays.schema.json @@ -56,7 +56,8 @@ "type":"array", "description": "This is an array", "items": { - "type": "number" + "type": "number", + "minimum": 10 }, "maxItems": 10 } diff --git a/templates/md/array-type.ejs b/templates/md/array-type.ejs new file mode 100644 index 0000000000000000000000000000000000000000..b544dfa528520146a5ae882a6b32239271ece5bd --- /dev/null +++ b/templates/md/array-type.ejs @@ -0,0 +1,31 @@ +<% /** + * 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 + */ %> + +Array type: <%=schema.simpletype %>. +<% if (schema.items!==undefined) { %> + +All items must be of the type:<% +if (schema.items.type==="string") { + %><%- include("string-type",{schema:schema.items,_:_}) + %><% } else if (schema.items.type==="number"||schema.items.type==="integer") { + %><%- include("number-type",{schema:schema.items,_:_}) + %><% } else if (schema.items.type==="boolean") { + %><%- include("boolean-type",{schema:schema.items,_:_}) + %><% } else if (schema.items.type==="array") { %> +Nesting alarm! +<%- include("array-type",{schema:schema.items,_:_}) %> +<% } else { %> +Unknown type `<%= schema.type %>`. + + +```json +<%- JSON.stringify(schema, null, 2) %> +``` + +<% } %> + +<% } %> diff --git a/templates/md/property.ejs b/templates/md/property.ejs index 94491a0e789c7669d3cee03d3bb1958287d77500..41e588d8929a970b2b39933e61894d27aef7ab98 100644 --- a/templates/md/property.ejs +++ b/templates/md/property.ejs @@ -41,6 +41,8 @@ The value of this property **must** be equal to one of the [known values below]( <%- include("number-type",{schema:schema,_:_}) %> <% } else if (schema.type==="boolean") { %> <%- include("boolean-type",{schema:schema,_:_}) %> +<% } else if (schema.type==="array") { %> +<%- include("array-type",{schema:schema,_:_}) %> <% } else { %> Unknown type `<%= schema.type %>`.