forked from rom1504/docson
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
125 lines (124 loc) · 4.39 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html>
<head>
<title>Docson Example</title>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/docson.css">
<script src="../lib/require.js"></script></head>
<body>
<div id="doc"></div>
<script charset="utf-8">
require.config({ baseUrl: ".."});
require(["docson", "lib/jquery"], function(docson) {
$(function() {
var schema =
{
"id": "Invoice",
"description": "Represents the _document_ sent to the customer for payment.",
"properties": {
"customer": {
"description": "---\nWho will pay?\nNot me!",
"type": "string",
"maxLength": 25
},
"tags": {
"additionalProperties": {
"type": "number"
}
},
"lines": {
"description": "Invoice content ",
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": {
"$ref": "InvoiceLine"
}
},
"dimension": {
"description": "Total dimension of the order ",
"$ref": "Dimension"
},
"props": {
"properties": {
"key": {
"type": "string",
"pattern": "[a-z][0-9]_"
},
"value" : {
"type": "string"
}
}
}
},
"required": [ "customer" ],
"InvoiceLine": {
"id": "InvoiceLine",
"properties": {
"product": {
"$ref": "Product"
},
"quantity": {
"type": "number"
}
}
},
"Dimension": {
"id": "Dimension",
"properties": {
"width": {
"description": "Width in cm ",
"type": "number",
"minimum": 2,
"exclusiveMinimum": true
},
"height": {
"description": "Height in cm ",
"type": "number",
"format": "int64",
"default": 0
},
"length": {
"description": "Length in cm ",
"type": "number"
}
}
},
"Product": {
"id": "Product",
"properties": {
"name": {
"description": "Uniquely defines the product ",
"type": "string"
},
"dimension": {
"description": "How big it is ",
"$ref": "Dimension"
},
"category": {
"description": "Classification ",
"$ref": "Category"
}
}
},
"Category": {
"id": "Category",
"properties": {
"name": {
"description": "Uniquely identifies the category ",
"type": "string"
},
"level": {
"description": "Classification level from 1 to 5 (highest) ",
"type": "number"
}
}
}
}
docson.templateBaseUrl="../templates";
docson.doc("doc", schema);
});
});
</script>
</body>
</html>