File: index.html

package info (click to toggle)
jsonnet 0.17.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,344 kB
  • sloc: cpp: 23,062; python: 1,705; ansic: 865; sh: 708; javascript: 576; makefile: 187; java: 140
file content (318 lines) | stat: -rw-r--r-- 9,281 bytes parent folder | download
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
---
layout: default
title: The Data Templating Language
---

<div class=hgroup>
  <div class=hgroup-inline>
    <div class=panel>
      <table>
        <tr>
          <td><img id=big-logo src=img/isologo.svg></td>
          <td class=side-text>
            <p>
              A data templating language<br>
              for app and tool developers
            </p>
            <ul>
              <li>Generate config data</li>
              <li>Side-effect free</li>
              <li>Organize, simplify, unify</li>
              <li>Manage sprawling config</li>
            </ul>
          </td>
        </tr>
      </table>
    </div>
    <div class=panel>
      <table class=venn>
        <tr>
          <td>
            <p>
              A simple extension of <a href="http://json.org/">JSON</a><br>
            </p>
            <ul>
              <li>Open source (Apache 2.0)</li>
              <li>Familiar syntax</li>
              <li>Reformatter, linter</li>
              <li>Editor &amp; IDE integrations</li>
              <li>Formally specified</li>
            </ul>
          </td>
          <td class=venn-cell><img id=venn src=img/venn.svg></td>
        </tr>
      </table>
    </div>
    <div style="clear: both"></div>
  </div>
</div>

<div class=hgroup>
  <div class=hgroup-inline>
    <div class=panel>
      <p class=center>Eliminate duplication with object-orientation:</p>
    </div>
    <div style="clear: both"></div>
  </div>
</div>

<div class="inverse hgroup">
  <div class=hgroup-inline>
    <div class="tab-window-input" id="example1-input">
      <div class="tab-header">
      </div>
      <textarea id=example1-jsonnet autofocus>
        // Edit me!
        {
          person1: {
            name: "Alice",
            welcome: "Hello " + self.name + "!",
          },
          person2: self.person1 { name: "Bob" },
        }
      </textarea>
    </div>
    <div class="bigarrow">➡</div>
    <div class="tab-window-output" id="example1-output">
      <div class="tab-header">
        <div class=selected onclick="tab_output_click(this, 'example1-json-output')">
          output.json
        </div>
      </div>
      <textarea readonly class="selected code-json" id="example1-json-output">
        {
          "person1": {
            "name": "Alice",
            "welcome": "Hello Alice!"
          },
          "person2": {
            "name": "Bob",
            "welcome": "Hello Bob!"
          }
        }
      </textarea>
    </div>
    <script>
      demo(
        'example1-input',
        {
          'example1-jsonnet': 'example1.jsonnet',
        },
        'example1.jsonnet',
        'example1-output',
        false,
        false
      );
    </script>
    <div style="clear: both"></div>
  </div>
</div>

<div class=hgroup>
  <div class=hgroup-inline>
    <div class=panel>
      <p class=center>Or, use functions:</p>
    </div>
    <div style="clear: both"></div>
  </div>
</div>

<div class="inverse hgroup">
  <div class=hgroup-inline>
    <div class="tab-window-input" id="example2-input">
      <div class="tab-header">
      </div>
      <textarea id=example2-jsonnet autofocus>
        // A function that returns an object.
        local Person(name='Alice') = {
          name: name,
          welcome: 'Hello ' + name + '!',
        };
        {
          person1: Person(),
          person2: Person('Bob'),
        }
      </textarea>
    </div>
    <div class="bigarrow">➡</div>
    <div class="tab-window-output" id="example2-output">
      <div class="tab-header">
        <div class=selected onclick="tab_output_click(this, 'example2-json-output')">
          output.json
        </div>
      </div>
      <textarea readonly class="selected code-json" id="example2-json-output">
        {
          "person1": {
            "name": "Alice",
            "welcome": "Hello Alice!"
          },
          "person2": {
            "name": "Bob",
            "welcome": "Hello Bob!"
          }
        }
      </textarea>
    </div>
    <script>
      demo(
        'example2-input',
        {
          'example2-jsonnet': 'example2.jsonnet',
        },
        'example2.jsonnet',
        'example2-output',
        false,
        false
      );
    </script>
    <div style="clear: both"></div>
  </div>
</div>

<div class=hgroup>
  <div class=hgroup-inline>
    <div class=panel>
      <p class=center>
        Integrate with existing / custom applications.<br>
        Generate JSON, YAML, INI, and other formats.
      </p>
    </div>
    <div style="clear: both"></div>
  </div>
</div>

<div class="inverse hgroup">
  <div class=hgroup-inline>
    <div class="tab-window-input" id="example3-input">
      <div class="tab-header">
      </div>
      <textarea id=example3-jsonnet>
        local application = 'my-app';
        local module = 'uwsgi_module';
        local dir = '/var/www';
        local permission = 644;

        {
          'uwsgi.ini': std.manifestIni({
            sections: {
              uwsgi: {
                module: module,
                pythonpath: dir,
                socket: dir + '/uwsgi.sock',
                'chmod-socket': permission,
                callable: application,
                logto: '/var/log/uwsgi/uwsgi.log',
              },
            },
          }),
         
          'init.sh': |||
            #!/bin/bash
            mkdir -p %(dir)s
            touch %(dir)s/initialized
            chmod %(perm)d %(dir)s/initialized
          ||| % {dir: dir, perm: permission},

          'cassandra.conf': std.manifestYamlDoc({
            cluster_name: application,
            seed_provider: [
              {
                class_name: 'SimpleSeedProvider',
                parameters: [{ seeds: '127.0.0.1' }],
              },
            ],
          }),
        }
      </textarea>
    </div>
    <div class="bigarrow">➡</div>
    <div class="tab-window-output" id="example3-output">
      <div class="tab-header">
        <div class=selected onclick="tab_output_click(this, 'example3-yaml-output')">
          cassandra.conf
        </div>
        <div class=unselected onclick="tab_output_click(this, 'example3-sh-output')">
          init.sh
        </div>
        <div class=unselected onclick="tab_output_click(this, 'example3-ini-output')">
          uwsgi.ini
        </div>
      </div>
      <textarea readonly class="selected code-json" id="example3-yaml-output">
        "cluster_name": "my-app"
        "seed_provider": 
        - "class_name": "SimpleSeedProvider"
          "parameters": 
          - "seeds": "127.0.0.1"
      </textarea>
      <textarea readonly class="unselected code-json" id="example3-sh-output">
        #!/bin/bash
        mkdir -p /var/www
        touch /var/www/initialized
        chmod 644 /var/www/initialized
      </textarea>
      <textarea readonly class="unselected code-json" id="example3-ini-output">
        [uwsgi]
        callable = my-app
        chmod-socket = 644
        logto = /var/log/uwsgi/uwsgi.log
        module = uwsgi_module
        pythonpath = /var/www
        socket = /var/www/uwsgi.sock
      </textarea>
    </div>
    <script>
      demo(
        'example3-input',
        {
          'example3-jsonnet': 'example3.jsonnet',
        },
        'example3.jsonnet',
        'example3-output',
        true,
        true
      );
    </script>
    <div style="clear: both"></div>
  </div>
</div>

<div class=hgroup>
  <div class=hgroup-inline>
    <div class=panel>
      <p class=padded>
        The name Jsonnet is a portmanteau of JSON and <a
        href="http://en.wikipedia.org/wiki/Sonnet"><i>sonnet</i></a>, pronounced "jay sonnet".  It
        began life early 2014 as a 20% project and was launched on Aug 6.  The design is influenced
        by several configuration languages internal to Google, and embodies years of experience
        configuring some of the world's most complex IT systems.  Jsonnet is now used by many
        companies and projects.  Jsonnet is not an official Google product (experimental or
        otherwise), it is just code that happens to be owned by Google.
      </p>
    </div>

    <div class=panel>
      <p class=center>
        <a href='https://bitnami.com'><img class=user-logo src=img/users/bitnami.png></a>
        <!--
        <a href='https://www.box.com'><img class=user-logo src=img/users/box.jpg></a>
        <a href='https://coreos.com'><img class=user-logo src=img/users/coreos.svg></a>
        <a href='https://databricks.com'><img class=user-logo src=img/users/databricks.png></a>
        <a href='https://vr.google.com/daydream/'>
          <img class=user-logo src=img/users/daydream-logo.png></a>
        -->
        <a href='https://deepmind.com'><img class=user-logo src=img/users/deepmind.png></a>
        <!--
        <a href='https://grafana.com'><img class=user-logo src=img/users/grafana.svg></a>
        -->
        <a href='https://www.heptio.com'><img class=user-logo src=img/users/heptio.jpg></a>
        <a href='https://kausal.co'><img class=user-logo src=img/users/kausal.svg></a>
        <!--
        <a href='https://www.spinnaker.io'><img class=user-logo src=img/users/spinnaker.png></a>
        -->
      </p class=center>
    </div>
    <div style="clear: both"></div>
  </div>  
</div>