Fix #37 display example with type in schema

This commit is contained in:
Kam Low 2017-03-01 16:02:33 +01:00
parent a032239bd1
commit c716b47d67
4 changed files with 17 additions and 12 deletions

View File

@ -51,9 +51,14 @@ var common = {
Object.keys(cloned).forEach(function(propName) { Object.keys(cloned).forEach(function(propName) {
var prop = cloned[propName]; var prop = cloned[propName];
if (prop.type) { if (prop.type) {
cloned[propName] = prop.type; if (prop.example) {
if (prop.format) { cloned[propName] = prop.example;
cloned[propName] += ('(' + prop.format + ')'); }
else {
cloned[propName] = prop.type;
if (prop.format) {
cloned[propName] += ('(' + prop.format + ')');
}
} }
} }
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "spectacle-docs", "name": "spectacle-docs",
"version": "0.7.0", "version": "0.7.2",
"description": "Generate beautiful static API documentation from OpenAPI/Swagger 2.0 specifications", "description": "Generate beautiful static API documentation from OpenAPI/Swagger 2.0 specifications",
"preferGlobal": true, "preferGlobal": true,
"bin": { "bin": {

View File

@ -248,7 +248,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>
@ -294,7 +294,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>
@ -373,7 +373,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>
@ -532,7 +532,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>
@ -677,7 +677,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>
@ -1112,7 +1112,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>
@ -1271,7 +1271,7 @@
<span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span> <span class="hljs-attr">&quot;$ref&quot;</span>: <span class="hljs-string"><a href="#definition-Category">&quot;#/definitions/Category&quot;</a></span>
}, },
<span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>, <span class="hljs-attr">&quot;id&quot;</span>: <span class="hljs-string">&quot;integer(int64)&quot;</span>,
<span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;name&quot;</span>: <span class="hljs-string">&quot;Gorgonzola&quot;</span>,
<span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>, <span class="hljs-attr">&quot;photoUrls&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>,
<span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>, <span class="hljs-attr">&quot;status&quot;</span>: <span class="hljs-string">&quot;string&quot;</span>,
<span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span> <span class="hljs-attr">&quot;tags&quot;</span>: <span class="hljs-string">&quot;array&quot;</span>

View File

@ -988,7 +988,7 @@
}, },
"name": { "name": {
"type": "string", "type": "string",
"example": "doggie" "example": "Gorgonzola"
}, },
"photoUrls": { "photoUrls": {
"type": "array", "type": "array",