Skip to content
Snippets Groups Projects
Commit 41b34d24 authored by Lars Trieloff's avatar Lars Trieloff
Browse files

[trivial] nested array formatting

parent 88b67100
Branches
Tags
No related merge requests found
...@@ -25,6 +25,7 @@ This is an example schema with examples for multiple array types and their const ...@@ -25,6 +25,7 @@ This is an example schema with examples for multiple array types and their const
| [intlist](#intlist) | `integer[]` | Optional | Arrays (this schema) | | [intlist](#intlist) | `integer[]` | Optional | Arrays (this schema) |
| [boollist](#boollist) | `boolean[]` | Optional | Arrays (this schema) | | [boollist](#boollist) | `boolean[]` | Optional | Arrays (this schema) |
| [numlist](#numlist) | `number[]` | Optional | Arrays (this schema) | | [numlist](#numlist) | `number[]` | Optional | Arrays (this schema) |
| [coordinatelist](#coordinatelist) | `number[][]` | Optional | Arrays (this schema) |
## list ## list
...@@ -51,6 +52,7 @@ All items must be of the type: ...@@ -51,6 +52,7 @@ All items must be of the type:
## listlist ## listlist
This is an array of arrays This is an array of arrays
...@@ -64,9 +66,9 @@ This is an array of arrays ...@@ -64,9 +66,9 @@ This is an array of arrays
### listlist Type ### listlist Type
Array type: `array[]` Nested array type: `array`
All items must be of the type:
Array type: `array` Array type: `array`
...@@ -75,6 +77,8 @@ Array type: `array` ...@@ -75,6 +77,8 @@ Array type: `array`
## stringlistlist ## stringlistlist
This is an array of arrays of strings This is an array of arrays of strings
...@@ -88,9 +92,9 @@ This is an array of arrays of strings ...@@ -88,9 +92,9 @@ This is an array of arrays of strings
### stringlistlist Type ### stringlistlist Type
Array type: `string[][]` Nested array type: `string[]`
All items must be of the type:
Array type: `string[]` Array type: `string[]`
All items must be of the type: All items must be of the type:
...@@ -105,6 +109,8 @@ All items must be of the type: ...@@ -105,6 +109,8 @@ All items must be of the type:
## intlist ## intlist
This is an array This is an array
...@@ -130,6 +136,7 @@ All items must be of the type: ...@@ -130,6 +136,7 @@ All items must be of the type:
## boollist ## boollist
This is an array This is an array
...@@ -153,6 +160,7 @@ All items must be of the type: ...@@ -153,6 +160,7 @@ All items must be of the type:
## numlist ## numlist
This is an array This is an array
...@@ -177,3 +185,40 @@ All items must be of the type: ...@@ -177,3 +185,40 @@ All items must be of the type:
## coordinatelist
This is an array of coordinates in three-dimensional space.
`coordinatelist`
* is optional
* type: `number[][]` (nested array)
* no more than `10` items in the array
* defined in this schema
### coordinatelist Type
Nested array type: `number[]`
Array type: `number[]`
All items must be of the type:
`number`
* minimum value: `0`
* maximum value: `10`
A coordinate, specified by `x`, `y`, and `z` values
...@@ -19,15 +19,15 @@ This is an example schema with *multiple* examples. Too many examples? There can ...@@ -19,15 +19,15 @@ This is an example schema with *multiple* examples. Too many examples? There can
```json ```json
{ {
"foo": "zip", "foo": "bi",
"bar": "zap" "bar": "bu"
} }
``` ```
```json ```json
{ {
"foo": "bi", "foo": "zip",
"bar": "bu" "bar": "zap"
} }
``` ```
......
...@@ -60,6 +60,22 @@ ...@@ -60,6 +60,22 @@
"minimum": 10 "minimum": 10
}, },
"maxItems": 10 "maxItems": 10
},
"coordinatelist": {
"type": "array",
"description": "This is an array of coordinates in three-dimensional space.",
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"description": "A coordinate, specified by `x`, `y`, and `z` values",
"items": {
"type": "number",
"minimum": 0,
"maximum": 10
}
},
"maxItems": 10
} }
} }
} }
\ No newline at end of file
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
"bar" "bar"
], ],
"examples": [ "examples": [
{
"foo": "zip",
"bar": "zap"
},
{ {
"foo": "bi", "foo": "bi",
"bar": "bu" "bar": "bu"
},
{
"foo": "zip",
"bar": "zap"
} }
] ]
} }
\ No newline at end of file
...@@ -4,11 +4,14 @@ ...@@ -4,11 +4,14 @@
* you may not use this file except in compliance with the License. You may obtain a copy * 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 * of the License at http://www.apache.org/licenses/LICENSE-2.0
*/ %> */ %>
<% if (schema.items!==undefined&&schema.items.type==="array") { %>
Nested array type: <%=schema.items.simpletype %>
<% } else { %>
Array type: <%=schema.simpletype %> Array type: <%=schema.simpletype %>
<% } %>
<% if (schema.items!==undefined) { %> <% if (schema.items!==undefined) { %>
<% if (!(schema.items!==undefined&&schema.items.type==="array")) { %>
All items must be of the type:<% All items must be of the type:<% }
if (schema.items.type==="string") { if (schema.items.type==="string") {
%><%- include("string-type",{schema:schema.items,_:_}) %><%- include("string-type",{schema:schema.items,_:_})
%><% } else if (schema.items.type==="number"||schema.items.type==="integer") { %><% } else if (schema.items.type==="number"||schema.items.type==="integer") {
...@@ -27,4 +30,10 @@ Unknown type `<%= schema.type %>`. ...@@ -27,4 +30,10 @@ Unknown type `<%= schema.type %>`.
<% } %> <% } %>
<% if (schema.items.description!==undefined) { %>
<%=schema.items.description %>
<% } %>
<% } %> <% } %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment