-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
98 lines (97 loc) · 3.09 KB
/
index.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
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Online JSONSchema to TypeScript Converter</title>
<link rel="stylesheet" href="./index.css" />
<link rel="stylesheet" href="https://kit-free.fontawesome.com/releases/v5.7.0/css/free.min.css" media="all" />
<script src="https://unpkg.com/prettier@3/standalone.js"></script>
<script src="https://unpkg.com/prettier@3/plugins/typescript.js"></script>
<script src="https://unpkg.com/prettier@3/plugins/estree.js"></script>
<script>
window.__dirname = '';
// standalone requires parsers be explicitly loaded
window.prettierWithOptions = {
format(str, options) {
return prettier.format(
str,
Object.assign({}, options, {
plugins: Object.assign({}, prettierPlugins, options.plugins)
})
);
}
};
</script>
<script src="./dist/bundle.js"></script>
</head>
<body>
<div id="app">
<div id="leftInput">
<h2>Input (JSON Schema)</h2>
<div class="buttons">
<span class="button" id="errorIcon" title="There was an error compiling your schema" style="display: none">
<i class="fa fa-lg fa-exclamation"></i>
</span>
<button class="button" id="formatButton" title="Format">
<i class="fa fa-lg fa-broom"></i>
</button>
<div class="dropdown">
<button class="button" id="configButton" title="Options">
<i class="fa fa-lg fa-cog"></i>
</button>
<div class="dropdown-content">
<input id="declareExternallyReferenced" type="checkbox" name="gender" value="true" checked />
<label for="declareExternallyReferenced">declareExternallyReferenced</label>
<br />
<input id="enableConstEnums" type="checkbox" name="gender" value="true" checked />
<label for="enableConstEnums">enableConstEnums</label>
<br />
<input id="unreachableDefinitions" type="checkbox" name="gender" value="false" />
<label for="unreachableDefinitions">unreachableDefinitions</label>
<br />
<input id="strictIndexSignatures" type="checkbox" name="strictIndexSignatures" value="false" />
<label for="strictIndexSignatures">strictIndexSignatures</label>
<br />
</div>
</div>
</div>
<textarea>
{
"title": "Example Schema",
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
},
"hairColor": {
"enum": [
"black",
"brown",
"blue"
],
"type": "string"
}
},
"additionalProperties": false,
"required": [
"firstName",
"lastName"
]
}</textarea
>
</div>
<div id="rightOutput">
<h2>Output (TypeScript)</h2>
<textarea readonly></textarea>
</div>
</div>
</body>
</html>