mirror of
https://github.com/sourcey/spectacle.git
synced 2024-09-11 05:25:36 +03:00
Fix #37 display example with type
in schema
This commit is contained in:
parent
a032239bd1
commit
c716b47d67
@ -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 + ')');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -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": {
|
||||||
|
@ -248,7 +248,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
@ -294,7 +294,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
@ -373,7 +373,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
@ -532,7 +532,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
@ -677,7 +677,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
@ -1112,7 +1112,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
@ -1271,7 +1271,7 @@
|
|||||||
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
<span class="hljs-attr">"$ref"</span>: <span class="hljs-string"><a href="#definition-Category">"#/definitions/Category"</a></span>
|
||||||
},
|
},
|
||||||
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
<span class="hljs-attr">"id"</span>: <span class="hljs-string">"integer(int64)"</span>,
|
||||||
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"name"</span>: <span class="hljs-string">"Gorgonzola"</span>,
|
||||||
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
<span class="hljs-attr">"photoUrls"</span>: <span class="hljs-string">"array"</span>,
|
||||||
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
<span class="hljs-attr">"status"</span>: <span class="hljs-string">"string"</span>,
|
||||||
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
<span class="hljs-attr">"tags"</span>: <span class="hljs-string">"array"</span>
|
||||||
|
2
test/fixtures/cheese.json
vendored
2
test/fixtures/cheese.json
vendored
@ -988,7 +988,7 @@
|
|||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"example": "doggie"
|
"example": "Gorgonzola"
|
||||||
},
|
},
|
||||||
"photoUrls": {
|
"photoUrls": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
Loading…
Reference in New Issue
Block a user