-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.json
85 lines (85 loc) · 3.64 KB
/
template.json
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
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "templateSchema",
"title": "tempateSchema schema definition",
"oneOf": [
{
"allOf": [
{
"$ref": "http://json-schema.org/draft-07/schema#"
},
{
"type": "object",
"properties": {
"view": {
"type": "object",
"description": "a sample view to render the template with"
},
"template": {
"type": "string",
"format": "mustache",
"description": "a mustache template component"
},
"definitions": {
"type": "object",
"additionalProperties": {
"$ref": "#"
}
},
"allOf": {
"type": "array",
"items": {
"$ref": "#"
}
},
"oneOf": {
"type": "array",
"items": {
"$ref": "#"
}
},
"anyOf": {
"type": "array",
"items": {
"$ref": "#"
}
},
"contentType": {
"type": "string",
"description": "MIME type of the rendered template output",
"default": "text/plain"
},
"httpForward": {
"properties": {
"url": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"description": "matches Node http.request() options object (https://nodejs.org/api/http.html#http_http_request_options_callback)",
"properties": {
"host": { "type": "string" },
"path": { "type": "string" }
}
}
]
}
},
"required": [
"url"
]
}
},
"required": [
"template"
]
}
]
},
{
"type": "string",
"format": "mustache"
}
],
"description": "# templateSchema\n\nProvide a hiearchy of template snippets using mustache style templates.\nthe system will digest and compile the mustache snippets and generate JSON\nschema that represents the input schema to the templates\n\nHTML Templating Example:\n\\`\\`\\`yaml\n view:\n message: Hello!\n definitions:\n body:\n template:\n <body>\n <h1>{{message}}</h1>\n </body>\n template: |\n <html>\n {{> body}}\n </html>\n\\`\\`\\`\n\nA templateSchema object is any object that passes this schema. In short,\nthese objects are valid json schema with a required 'template' property that\ncontains a mustache template.\n\nThe framework mainly acts using the follow three propeties:\n\ntemplate: the base template for this templateSchema object\ndefinitions: a dictionary of other templateSchema objects that can be used\n as partials in the top level template\nview: a view for the template will be rendered with\n\nWhen the system digests the schema, it will parse the template and any\npartials specified in the definitions object, and generate a top level schema\nof properties required to render the template.\n\nThe view object is optional, and can be used to provide an example or defaults\nfor the template.\n\nThe top level schema generated from parsing the mustache template will be used\nto validate the view object. This schema can then be used to validate other\nviews used to render the template.\n"
}