diff --git a/examples/docs/arrays.schema.md b/examples/docs/arrays.schema.md index 5d5186e67b9956ea8474ee71402bae161d361278..bee50407f99e612dc34d3b6e8292a08cbe7a20f6 100644 --- a/examples/docs/arrays.schema.md +++ b/examples/docs/arrays.schema.md @@ -21,6 +21,8 @@ This is an example schema with examples for multiple array types and their const |----------|------|----------|------------| | [list](#list) | `string[]` | Optional | Arrays (this schema) | | [intlist](#intlist) | `integer[]` | Optional | Arrays (this schema) | +| [boollist](#boollist) | `boolean[]` | Optional | Arrays (this schema) | +| [numlist](#numlist) | `number[]` | Optional | Arrays (this schema) | ## list @@ -29,6 +31,7 @@ This is an array `list` * is optional * type: `string[]` + * defined in this schema ### list Type @@ -58,6 +61,7 @@ This is an array `intlist` * is optional * type: `integer[]` +* between `1` and `10` items in the array * defined in this schema ### intlist Type @@ -72,6 +76,8 @@ Unknown type `array`. "type": "integer", "simpletype": "`integer`" }, + "maxItems": 10, + "minItems": 1, "simpletype": "`integer[]`" } ``` @@ -79,3 +85,65 @@ Unknown type `array`. + +## boollist + +This is an array + +`boollist` +* is optional +* type: `boolean[]` +* at least `1` items in the array +* defined in this schema + +### boollist Type + +Unknown type `array`. + +```json +{ + "type": "array", + "description": "This is an array", + "items": { + "type": "boolean", + "simpletype": "`boolean`" + }, + "minItems": 1, + "simpletype": "`boolean[]`" +} +``` + + + + + +## numlist + +This is an array + +`numlist` +* is optional +* type: `number[]` +* no more than `10` items in the array +* defined in this schema + +### numlist Type + +Unknown type `array`. + +```json +{ + "type": "array", + "description": "This is an array", + "items": { + "type": "number", + "simpletype": "`number`" + }, + "maxItems": 10, + "simpletype": "`number[]`" +} +``` + + + + diff --git a/examples/generated-schemas/arrays.schema.json b/examples/generated-schemas/arrays.schema.json index 44df550b2fe2f950ad5cd576fc2bee1fa57fce96..f11dc1d3ff685212d37314695423e6aa1d67cfdb 100644 --- a/examples/generated-schemas/arrays.schema.json +++ b/examples/generated-schemas/arrays.schema.json @@ -23,7 +23,25 @@ "description": "This is an array", "items": { "type": "integer" - } + }, + "maxItems": 10, + "minItems": 1 + }, + "boollist": { + "type": "array", + "description": "This is an array", + "items": { + "type": "boolean" + }, + "minItems": 1 + }, + "numlist": { + "type": "array", + "description": "This is an array", + "items": { + "type": "number" + }, + "maxItems": 10 } } } \ No newline at end of file diff --git a/examples/schemas/arrays.schema.json b/examples/schemas/arrays.schema.json index f70e6a105e146bc7d38b346db0b5bbbf55640703..134cba4bf64aa76ecd702a42b9649b02d918ff46 100644 --- a/examples/schemas/arrays.schema.json +++ b/examples/schemas/arrays.schema.json @@ -26,6 +26,22 @@ }, "maxItems": 10, "minItems": 1 + }, + "boollist": { + "type":"array", + "description": "This is an array", + "items": { + "type": "boolean" + }, + "minItems": 1 + }, + "numlist": { + "type":"array", + "description": "This is an array", + "items": { + "type": "number" + }, + "maxItems": 10 } } } diff --git a/templates/md/property.ejs b/templates/md/property.ejs index 641c092967cfbb46c361c814c602dfbeb11bccec..09f328baf244b99eff92ad5aa2c3b7fbb4f68785 100644 --- a/templates/md/property.ejs +++ b/templates/md/property.ejs @@ -15,9 +15,9 @@ `<%=name %>` * is <% if (required) { %>**required**<% } else { %>optional<% } %> * type: <%=schema.simpletype %><% if (schema.type==='array') { %> -<% if (schema.maxItems!==undefined&&schema.minItems!==undefined) { %>* between `x` and `y` items in the array<% } -else if (schema.maxItems!==undefined ) { %>* no more than `y` items in the array<% } -else if (schema.minItems!==undefined ) { %>* at least `x` items in the array<% } %> +<% if (schema.maxItems!==undefined&&schema.minItems!==undefined) { %>* between `<%=schema.minItems %>` and `<%=schema.maxItems %>` items in the array<% } +else if (schema.maxItems!==undefined ) { %>* no more than `<%=schema.maxItems %>` items in the array<% } +else if (schema.minItems!==undefined ) { %>* at least `<%=schema.minItems %>` items in the array<% } %> <% } %> * defined in <% if (schema.$oSchema) { %>[<%= schema.$oSchema.$linkVal %>](<%= schema.$oSchema.$linkPath %>#<%= name %>)<% } else { %>this schema<% } %>