-
Notifications
You must be signed in to change notification settings - Fork 4
/
json-multi-schema-validator.html
49 lines (47 loc) · 2.01 KB
/
json-multi-schema-validator.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
<script type="text/javascript">
/* global RED:false */
RED.nodes.registerType('json-multi-schema-validator', {
category: 'function',
color: '#00B4FF',
defaults: {
name: { value: '' },
schemaVersion: { value: 'draft-07' },
},
inputs: 1,
outputs: 1,
icon: 'function.png',
label: function () {
return this.name || 'json-multi-schema-validator';
},
});
</script>
<script type="text/x-red" data-template-name="json-multi-schema-validator">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" />
</div>
<div class="form-row">
<label for="node-input-schemaVersion"><i class="fa fa-flag"></i> JSON Schema version</label>
<select id="node-input-schemaVersion">
<option value="draft-07">draft-07 (default)</option>
<option value="draft-2019-09">draft-2019-09 (newer but slower) + draft-07</option>
<option value="draft-2020-12">draft-2020-12 (newest, not backwards compatible)</option>
<option value="draft-06">draft-06 (obsolete) + draft-07</option>
<option value="draft-04">draft-04 (obsolete, deprecated)</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="json-multi-schema-validator">
<ul>
<li>The node will validate the JSON data given in <code>msg.payload</code> against the JSON Schema URL given in <code>msg.schemaUrl</code></li>
<li>If any validation was actually performed, the URL of the corresponding JSON Schema file is returned in <code>msg.validUrl</code>.</li>
<li>The content of <code>msg.payload</code> is unchanged. If no <code>msg.schemaUrl</code> is provided, no validation is performed.</li>
<li>Errors are returned on <code>msg.error</code></li>
</ul>
<h3>Options</h3>
<dl>
<dt>schemaVersion</dt>
<dd>Version of <a href="http://json-schema.org/specification.html">JSON Schema</a> to use</dd>
<dd>See the <a href="https://ajv.js.org/json-schema.html#json-schema-versions">documentation from the underlying library</a></dd>
</dl>
</script>