From 70f5419c38f070db310d61a8e9633a1ca6bcafeb Mon Sep 17 00:00:00 2001 From: Lars Trieloff <trieloff@adobe.com> Date: Fri, 5 Jan 2018 14:42:13 +0000 Subject: [PATCH] show the correct nested type, provide example for #26 --- examples/docs/arrays.schema.md | 48 +++++++++++++++++++ examples/generated-schemas/arrays.schema.json | 17 +++++++ examples/schemas/arrays.schema.json | 17 +++++++ templates/md/array-type.ejs | 2 +- 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/examples/docs/arrays.schema.md b/examples/docs/arrays.schema.md index e4f9f73..a37f8cf 100644 --- a/examples/docs/arrays.schema.md +++ b/examples/docs/arrays.schema.md @@ -25,6 +25,7 @@ This is an example schema with examples for multiple array types and their const | [list](#list) | `string[]` | Optional | Arrays (this schema) | | [listlist](#listlist) | `array[]` | Optional | Arrays (this schema) | | [numlist](#numlist) | `number[]` | Optional | Arrays (this schema) | +| [objectlist](#objectlist) | `object[]` | Optional | Arrays (this schema) | | [stringlistlist](#stringlistlist) | `string[][]` | Optional | Arrays (this schema) | ## boollist @@ -187,6 +188,53 @@ All items must be of the type: +## objectlist + +An array of simple objects + +`objectlist` +* is optional +* type: `object[]` + +* defined in this schema + +### objectlist Type + + +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[]`" +} +``` + + + + + + + + ## stringlistlist This is an array of arrays of strings diff --git a/examples/generated-schemas/arrays.schema.json b/examples/generated-schemas/arrays.schema.json index 607a21b..42200b1 100644 --- a/examples/generated-schemas/arrays.schema.json +++ b/examples/generated-schemas/arrays.schema.json @@ -76,6 +76,23 @@ } }, "maxItems": 10 + }, + "objectlist": { + "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" + } + } + } } } } \ No newline at end of file diff --git a/examples/schemas/arrays.schema.json b/examples/schemas/arrays.schema.json index 308f676..2d9bb70 100644 --- a/examples/schemas/arrays.schema.json +++ b/examples/schemas/arrays.schema.json @@ -76,6 +76,23 @@ } }, "maxItems": 10 + }, + "objectlist": { + "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" + } + } + } } } } diff --git a/templates/md/array-type.ejs b/templates/md/array-type.ejs index 1890a8d..68f3761 100644 --- a/templates/md/array-type.ejs +++ b/templates/md/array-type.ejs @@ -23,7 +23,7 @@ if (schema.items.type==="string") { %><% } else if (schema.items.$ref!==undefined) { %><%- include("referenced-type",{schema:schema.items,_:_}) %> <% } else { %> -Unknown type `<%= schema.type %>`. +Unknown type `<%= schema.items.type %>`. ```json -- GitLab