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

[trivial] nested array formatting

parent 88b67100
No related branches found
No related tags found
No related merge requests found
......@@ -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) |
| [boollist](#boollist) | `boolean[]` | Optional | Arrays (this schema) |
| [numlist](#numlist) | `number[]` | Optional | Arrays (this schema) |
| [coordinatelist](#coordinatelist) | `number[][]` | Optional | Arrays (this schema) |
## list
......@@ -51,6 +52,7 @@ All items must be of the type:
## listlist
This is an array of arrays
......@@ -64,9 +66,9 @@ This is an array of arrays
### listlist Type
Array type: `array[]`
Nested array type: `array`
All items must be of the type:
Array type: `array`
......@@ -75,6 +77,8 @@ Array type: `array`
## stringlistlist
This is an array of arrays of strings
......@@ -88,9 +92,9 @@ This is an array of arrays of strings
### stringlistlist Type
Array type: `string[][]`
Nested array type: `string[]`
All items must be of the type:
Array type: `string[]`
All items must be of the type:
......@@ -105,6 +109,8 @@ All items must be of the type:
## intlist
This is an array
......@@ -130,6 +136,7 @@ All items must be of the type:
## boollist
This is an array
......@@ -153,6 +160,7 @@ All items must be of the type:
## numlist
This is an array
......@@ -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
```json
{
"foo": "zip",
"bar": "zap"
"foo": "bi",
"bar": "bu"
}
```
```json
{
"foo": "bi",
"bar": "bu"
"foo": "zip",
"bar": "zap"
}
```
......
......@@ -60,6 +60,22 @@
"minimum": 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 @@
"bar"
],
"examples": [
{
"foo": "zip",
"bar": "zap"
},
{
"foo": "bi",
"bar": "bu"
},
{
"foo": "zip",
"bar": "zap"
}
]
}
\ No newline at end of file
......@@ -4,11 +4,14 @@
* 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
*/ %>
<% if (schema.items!==undefined&&schema.items.type==="array") { %>
Nested array type: <%=schema.items.simpletype %>
<% } else { %>
Array type: <%=schema.simpletype %>
<% } %>
<% if (schema.items!==undefined) { %>
All items must be of the type:<%
<% if (!(schema.items!==undefined&&schema.items.type==="array")) { %>
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") {
......@@ -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