quicktype 16.0.26 → 16.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +4 -1
- package/dist/quicktype-core/Transformers.js +3 -1
- package/dist/quicktype-core/input/JSONSchemaInput.js +8 -2
- package/dist/quicktype-core/language/All.js +1 -1
- package/dist/quicktype-core/language/CPlusPlus.js +53 -134
- package/dist/quicktype-core/language/CSharp.js +30 -37
- package/dist/quicktype-core/language/Elm.js +1 -4
- package/dist/quicktype-core/language/Golang.js +7 -7
- package/dist/quicktype-core/language/Haskell.js +15 -15
- package/dist/quicktype-core/language/Java.js +54 -51
- package/dist/quicktype-core/language/JavaScriptPropTypes.js +11 -11
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +1196 -65
- package/dist/quicktype-core/language/Kotlin.js +5 -20
- package/dist/quicktype-core/language/Pike.js +2 -9
- package/dist/quicktype-core/language/Rust.js +11 -11
- package/dist/quicktype-core/language/TypeScriptFlow.js +1 -1
- package/package.json +93 -94
|
@@ -20,12 +20,7 @@ var Framework;
|
|
|
20
20
|
Framework[Framework["KotlinX"] = 3] = "KotlinX";
|
|
21
21
|
})(Framework = exports.Framework || (exports.Framework = {}));
|
|
22
22
|
exports.kotlinOptions = {
|
|
23
|
-
framework: new RendererOptions_1.EnumOption("framework", "Serialization framework", [
|
|
24
|
-
["just-types", Framework.None],
|
|
25
|
-
["jackson", Framework.Jackson],
|
|
26
|
-
["klaxon", Framework.Klaxon],
|
|
27
|
-
["kotlinx", Framework.KotlinX]
|
|
28
|
-
], "klaxon"),
|
|
23
|
+
framework: new RendererOptions_1.EnumOption("framework", "Serialization framework", [["just-types", Framework.None], ["jackson", Framework.Jackson], ["klaxon", Framework.Klaxon], ["kotlinx", Framework.KotlinX]], "klaxon"),
|
|
29
24
|
acronymStyle: Acronyms_1.acronymOption(Acronyms_1.AcronymStyleOptions.Pascal),
|
|
30
25
|
packageName: new RendererOptions_1.StringOption("package", "Package", "PACKAGE", "quicktype")
|
|
31
26
|
};
|
|
@@ -297,16 +292,10 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
297
292
|
{
|
|
298
293
|
let table = [];
|
|
299
294
|
this.forEachUnionMember(u, nonNulls, "none", null, (name, t) => {
|
|
300
|
-
table.push([
|
|
301
|
-
["class ", name, "(val value: ", this.kotlinType(t), ")"],
|
|
302
|
-
[" : ", unionName, "()"]
|
|
303
|
-
]);
|
|
295
|
+
table.push([["class ", name, "(val value: ", this.kotlinType(t), ")"], [" : ", unionName, "()"]]);
|
|
304
296
|
});
|
|
305
297
|
if (maybeNull !== null) {
|
|
306
|
-
table.push([
|
|
307
|
-
["class ", this.nameForUnionMember(u, maybeNull), "()"],
|
|
308
|
-
[" : ", unionName, "()"]
|
|
309
|
-
]);
|
|
298
|
+
table.push([["class ", this.nameForUnionMember(u, maybeNull), "()"], [" : ", unionName, "()"]]);
|
|
310
299
|
}
|
|
311
300
|
this.emitTable(table);
|
|
312
301
|
}
|
|
@@ -783,11 +772,7 @@ class KotlinXRenderer extends KotlinRenderer {
|
|
|
783
772
|
const table = [];
|
|
784
773
|
table.push(["// val ", "json", " = Json { allowStructuredMapKeys = true }"]);
|
|
785
774
|
this.forEachTopLevel("none", (_, name) => {
|
|
786
|
-
table.push([
|
|
787
|
-
"// val ",
|
|
788
|
-
Source_1.modifySource(Strings_1.camelCase, name),
|
|
789
|
-
` = json.parse(${this.sourcelikeToString(name)}.serializer(), jsonString)`
|
|
790
|
-
]);
|
|
775
|
+
table.push(["// val ", Source_1.modifySource(Strings_1.camelCase, name), ` = json.parse(${this.sourcelikeToString(name)}.serializer(), jsonString)`]);
|
|
791
776
|
});
|
|
792
777
|
this.emitTable(table);
|
|
793
778
|
}
|
|
@@ -811,7 +796,7 @@ class KotlinXRenderer extends KotlinRenderer {
|
|
|
811
796
|
const escapedName = stringEscape(jsonName);
|
|
812
797
|
const namesDiffer = this.sourcelikeToString(propName) !== escapedName;
|
|
813
798
|
if (namesDiffer) {
|
|
814
|
-
return [
|
|
799
|
+
return ["@SerialName(\"", escapedName, "\")"];
|
|
815
800
|
}
|
|
816
801
|
return undefined;
|
|
817
802
|
}
|
|
@@ -151,10 +151,7 @@ class PikeRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
151
151
|
this.emitBlock([e.kind, " ", enumName], () => {
|
|
152
152
|
let table = [];
|
|
153
153
|
this.forEachEnumCase(e, "none", (name, jsonName) => {
|
|
154
|
-
table.push([
|
|
155
|
-
[name, ' = "', Strings_1.stringEscape(jsonName), '", '],
|
|
156
|
-
['// json: "', jsonName, '"']
|
|
157
|
-
]);
|
|
154
|
+
table.push([[name, ' = "', Strings_1.stringEscape(jsonName), '", '], ['// json: "', jsonName, '"']]);
|
|
158
155
|
});
|
|
159
156
|
this.emitTable(table);
|
|
160
157
|
});
|
|
@@ -195,11 +192,7 @@ class PikeRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
195
192
|
let table = [];
|
|
196
193
|
this.forEachClassProperty(c, "none", (name, jsonName, p) => {
|
|
197
194
|
const pikeType = this.sourceFor(p.type).source;
|
|
198
|
-
table.push([
|
|
199
|
-
[pikeType, " "],
|
|
200
|
-
[name, "; "],
|
|
201
|
-
['// json: "', jsonName, '"']
|
|
202
|
-
]);
|
|
195
|
+
table.push([[pikeType, " "], [name, "; "], ['// json: "', jsonName, '"']]);
|
|
203
196
|
});
|
|
204
197
|
this.emitTable(table);
|
|
205
198
|
}
|
|
@@ -271,17 +271,17 @@ class RustRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
|
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
273
|
const topLevelName = Support_1.defined(collection_utils_1.mapFirst(this.topLevels)).getCombinedName();
|
|
274
|
-
this.emitMultiline(`// Example code that deserializes and serializes the model.
|
|
275
|
-
// extern crate serde;
|
|
276
|
-
// #[macro_use]
|
|
277
|
-
// extern crate serde_derive;
|
|
278
|
-
// extern crate serde_json;
|
|
279
|
-
//
|
|
280
|
-
// use generated_module::${topLevelName};
|
|
281
|
-
//
|
|
282
|
-
// fn main() {
|
|
283
|
-
// let json = r#"{"answer": 42}"#;
|
|
284
|
-
// let model: ${topLevelName} = serde_json::from_str(&json).unwrap();
|
|
274
|
+
this.emitMultiline(`// Example code that deserializes and serializes the model.
|
|
275
|
+
// extern crate serde;
|
|
276
|
+
// #[macro_use]
|
|
277
|
+
// extern crate serde_derive;
|
|
278
|
+
// extern crate serde_json;
|
|
279
|
+
//
|
|
280
|
+
// use generated_module::${topLevelName};
|
|
281
|
+
//
|
|
282
|
+
// fn main() {
|
|
283
|
+
// let json = r#"{"answer": 42}"#;
|
|
284
|
+
// let model: ${topLevelName} = serde_json::from_str(&json).unwrap();
|
|
285
285
|
// }`);
|
|
286
286
|
}
|
|
287
287
|
emitSourceStructure() {
|
|
@@ -215,7 +215,7 @@ class TypeScriptRenderer extends TypeScriptFlowBaseRenderer {
|
|
|
215
215
|
this.emitDescription(this.descriptionForType(e));
|
|
216
216
|
if (this._tsFlowOptions.preferUnions) {
|
|
217
217
|
let items = "";
|
|
218
|
-
e.cases.forEach(item => {
|
|
218
|
+
e.cases.forEach((item) => {
|
|
219
219
|
if (items === "") {
|
|
220
220
|
items += `"${Strings_1.utf16StringEscape(item)}"`;
|
|
221
221
|
return;
|
package/package.json
CHANGED
|
@@ -1,98 +1,97 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
"name": "quicktype",
|
|
3
|
+
"version": "16.0.27",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "dist/cli/index.js",
|
|
6
|
+
"types": "dist/cli/index.d.ts",
|
|
7
|
+
"repository": "https://github.com/quicktype/quicktype",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"pub": "script/publish.sh",
|
|
10
|
+
"prepare": "npm run build",
|
|
11
|
+
"build": "script/build.ts",
|
|
12
|
+
"test": "jest && script/test",
|
|
13
|
+
"start": "script/watch",
|
|
14
|
+
"pkg": "script/make-pkgs.sh",
|
|
15
|
+
"tslint": "tslint --project src/cli --exclude 'src/__tests__/**' --exclude 'src/quicktype-core/input/io/get-stream/**'",
|
|
16
|
+
"clean": "rm -rf dist node_modules *~",
|
|
17
|
+
"publish": "script/publish.sh"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"chalk": "^2.4.1",
|
|
21
|
+
"collection-utils": "^1.0.1",
|
|
22
|
+
"command-line-args": "^4.0.6",
|
|
23
|
+
"command-line-usage": "^5.0.5",
|
|
24
|
+
"graphql": "^0.11.7",
|
|
25
|
+
"is-url": "^1.2.4",
|
|
26
|
+
"js-base64": "^2.4.3",
|
|
27
|
+
"lodash": "^4.17.21",
|
|
28
|
+
"moment": "^2.22.1",
|
|
29
|
+
"node-fetch": "^2.6.1",
|
|
30
|
+
"pako": "^1.0.6",
|
|
31
|
+
"pluralize": "^7.0.0",
|
|
32
|
+
"stream-json": "1.1.3",
|
|
33
|
+
"string-to-stream": "^1.1.0",
|
|
34
|
+
"typescript": "~3.2.1",
|
|
35
|
+
"@mark.probst/typescript-json-schema": "~0.32.0",
|
|
36
|
+
"@mark.probst/unicode-properties": "~1.1.0",
|
|
37
|
+
"urijs": "^1.19.11",
|
|
38
|
+
"uuid": "^3.2.1",
|
|
39
|
+
"wordwrap": "^1.0.0",
|
|
40
|
+
"yaml": "^1.5.0",
|
|
41
|
+
"readable-stream": "2.3.0",
|
|
42
|
+
"isomorphic-fetch": "^3.0.0",
|
|
43
|
+
"browser-or-node": "^1.2.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/urijs": "^1.19.8",
|
|
47
|
+
"@types/is-url": "^1.2.28",
|
|
48
|
+
"@types/jest": "^23.1.6",
|
|
49
|
+
"@types/lodash": "^4.14.108",
|
|
50
|
+
"@types/node": "8.10.10",
|
|
51
|
+
"@types/shelljs": "^0.7.8",
|
|
52
|
+
"@types/semver": "^5.5.0",
|
|
53
|
+
"@types/yaml": "^1.0.2",
|
|
54
|
+
"ajv": "^5.5.2",
|
|
55
|
+
"deep-equal": "^1.0.1",
|
|
56
|
+
"exit": "^0.1.2",
|
|
57
|
+
"jest": "^23.1.0",
|
|
58
|
+
"promise-timeout": "^1.3.0",
|
|
59
|
+
"semver": "^5.5.0",
|
|
60
|
+
"shelljs": "^0.8.5",
|
|
61
|
+
"ts-jest": "^23.1.3",
|
|
62
|
+
"ts-node": "^10.9.1",
|
|
63
|
+
"tslint": "^5.11.0",
|
|
64
|
+
"uglify-js": "^3.3.22",
|
|
65
|
+
"watch": "^1.0.2",
|
|
66
|
+
"@types/graphql": "^0.11.7",
|
|
67
|
+
"@types/js-base64": "^2.3.1",
|
|
68
|
+
"@types/pako": "^1.0.0",
|
|
69
|
+
"@types/pluralize": "0.0.28",
|
|
70
|
+
"@types/readable-stream": "2.3.9",
|
|
71
|
+
"@types/browser-or-node": "^1.2.0",
|
|
72
|
+
"prettier": "^2.8.1"
|
|
73
|
+
},
|
|
74
|
+
"files": [
|
|
75
|
+
"dist/**"
|
|
76
|
+
],
|
|
77
|
+
"bin": "dist/cli/index.js",
|
|
78
|
+
"jest": {
|
|
79
|
+
"transform": {
|
|
80
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
19
81
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"command-line-usage": "^5.0.5",
|
|
25
|
-
"graphql": "^0.11.7",
|
|
26
|
-
"is-url": "^1.2.4",
|
|
27
|
-
"js-base64": "^2.4.3",
|
|
28
|
-
"lodash": "^4.17.21",
|
|
29
|
-
"moment": "^2.22.1",
|
|
30
|
-
"node-fetch": "^2.6.1",
|
|
31
|
-
"pako": "^1.0.6",
|
|
32
|
-
"pluralize": "^7.0.0",
|
|
33
|
-
"stream-json": "1.1.3",
|
|
34
|
-
"string-to-stream": "^1.1.0",
|
|
35
|
-
"typescript": "~3.2.1",
|
|
36
|
-
"@mark.probst/typescript-json-schema": "~0.32.0",
|
|
37
|
-
"@mark.probst/unicode-properties": "~1.1.0",
|
|
38
|
-
"urijs": "^1.19.11",
|
|
39
|
-
"uuid": "^3.2.1",
|
|
40
|
-
"wordwrap": "^1.0.0",
|
|
41
|
-
"yaml": "^1.5.0",
|
|
42
|
-
"readable-stream": "2.3.0",
|
|
43
|
-
"isomorphic-fetch": "^3.0.0",
|
|
44
|
-
"browser-or-node": "^1.2.1"
|
|
82
|
+
"globals": {
|
|
83
|
+
"ts-jest": {
|
|
84
|
+
"tsConfigFile": "src/cli/tsconfig.json"
|
|
85
|
+
}
|
|
45
86
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"deep-equal": "^1.0.1",
|
|
57
|
-
"exit": "^0.1.2",
|
|
58
|
-
"jest": "^23.1.0",
|
|
59
|
-
"promise-timeout": "^1.3.0",
|
|
60
|
-
"semver": "^5.5.0",
|
|
61
|
-
"shelljs": "^0.8.5",
|
|
62
|
-
"ts-jest": "^23.1.3",
|
|
63
|
-
"ts-node": "^10.9.1",
|
|
64
|
-
"tslint": "^5.11.0",
|
|
65
|
-
"uglify-js": "^3.3.22",
|
|
66
|
-
"watch": "^1.0.2",
|
|
67
|
-
"@types/graphql": "^0.11.7",
|
|
68
|
-
"@types/js-base64": "^2.3.1",
|
|
69
|
-
"@types/pako": "^1.0.0",
|
|
70
|
-
"@types/pluralize": "0.0.28",
|
|
71
|
-
"@types/readable-stream": "2.3.9",
|
|
72
|
-
"@types/browser-or-node": "^1.2.0",
|
|
73
|
-
"prettier": "^2.8.1"
|
|
74
|
-
},
|
|
75
|
-
"files": [
|
|
76
|
-
"dist/**"
|
|
77
|
-
],
|
|
78
|
-
"bin": "dist/cli/index.js",
|
|
79
|
-
"jest": {
|
|
80
|
-
"transform": {
|
|
81
|
-
"^.+\\.tsx?$": "ts-jest"
|
|
82
|
-
},
|
|
83
|
-
"globals": {
|
|
84
|
-
"ts-jest": {
|
|
85
|
-
"tsConfigFile": "src/cli/tsconfig.json"
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"testRegex": "(/__tests__/.*)\\.test\\.(tsx?)$",
|
|
89
|
-
"moduleFileExtensions": [
|
|
90
|
-
"ts",
|
|
91
|
-
"tsx",
|
|
92
|
-
"js",
|
|
93
|
-
"jsx",
|
|
94
|
-
"json",
|
|
95
|
-
"node"
|
|
96
|
-
]
|
|
97
|
-
}
|
|
87
|
+
"testRegex": "(/__tests__/.*)\\.test\\.(tsx?)$",
|
|
88
|
+
"moduleFileExtensions": [
|
|
89
|
+
"ts",
|
|
90
|
+
"tsx",
|
|
91
|
+
"js",
|
|
92
|
+
"jsx",
|
|
93
|
+
"json",
|
|
94
|
+
"node"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
98
97
|
}
|