quicktype-core 6.1.4 → 6.1.6
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/TypeGraph.js
CHANGED
|
@@ -364,7 +364,7 @@ function optionalToNullable(graph, stringTypeMapping, debugPrintReconstitution)
|
|
|
364
364
|
const attributes = TypeNames_1.namesTypeAttributeKind.setDefaultInAttributes(t.getAttributes(), () => TypeNames_1.TypeNames.make(new Set([name]), new Set(), true));
|
|
365
365
|
ref = builder.getUnionType(attributes, members);
|
|
366
366
|
}
|
|
367
|
-
return builder.makeClassProperty(ref,
|
|
367
|
+
return builder.makeClassProperty(ref, p.isOptional);
|
|
368
368
|
});
|
|
369
369
|
if (c.isFixed) {
|
|
370
370
|
return builder.getUniqueClassType(c.getAttributes(), true, properties, forwardingRef);
|
|
@@ -79,11 +79,7 @@ class JavaScriptPropTypesRenderer extends ConvenienceRenderer_1.ConvenienceRende
|
|
|
79
79
|
return match;
|
|
80
80
|
}
|
|
81
81
|
typeMapTypeForProperty(p) {
|
|
82
|
-
|
|
83
|
-
if (!p.isOptional) {
|
|
84
|
-
return typeMap;
|
|
85
|
-
}
|
|
86
|
-
return ["PropType.any"];
|
|
82
|
+
return this.typeMapTypeFor(p.type);
|
|
87
83
|
}
|
|
88
84
|
importStatement(lhs, moduleName) {
|
|
89
85
|
if (this._jsOptions.moduleSystem) {
|
package/dist/language/Python.js
CHANGED
|
@@ -878,7 +878,14 @@ class JSONPythonRenderer extends PythonRenderer {
|
|
|
878
878
|
this.emitLine("result", this.typeHint(": dict"), " = {}");
|
|
879
879
|
this.forEachClassProperty(t, "none", (name, jsonName, cp) => {
|
|
880
880
|
const property = { value: ["self.", name] };
|
|
881
|
-
|
|
881
|
+
if (cp.isOptional) {
|
|
882
|
+
this.emitBlock(["if self.", name, " is not None:"], () => {
|
|
883
|
+
this.emitLine("result[", this.string(jsonName), "] = ", makeValue(this.serializer(property, cp.type)));
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
else {
|
|
887
|
+
this.emitLine("result[", this.string(jsonName), "] = ", makeValue(this.serializer(property, cp.type)));
|
|
888
|
+
}
|
|
882
889
|
});
|
|
883
890
|
this.emitLine("return result");
|
|
884
891
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicktype-core",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.6",
|
|
4
4
|
"description": "The quicktype engine as a library",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"fs": false
|
|
46
46
|
},
|
|
47
47
|
"config": {
|
|
48
|
-
"commit": "
|
|
48
|
+
"commit": "6eb66b53a444b9e64b14dc191cb6716e274b3504"
|
|
49
49
|
}
|
|
50
50
|
}
|