quicktype-core 20.0.22 → 20.0.23

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.
@@ -698,10 +698,16 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
698
698
  }
699
699
  let typeSource = (0, TypeUtils_1.matchType)(t, _anyType => {
700
700
  isOptional = false;
701
- return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.anyTypeIssueAnnotation, [this.jsonQualifier(inJsonNamespace), "json"]);
701
+ return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.anyTypeIssueAnnotation, [
702
+ this.jsonQualifier(inJsonNamespace),
703
+ "json"
704
+ ]);
702
705
  }, _nullType => {
703
706
  isOptional = false;
704
- return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.nullTypeIssueAnnotation, [this.jsonQualifier(inJsonNamespace), "json"]);
707
+ return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.nullTypeIssueAnnotation, [
708
+ this.jsonQualifier(inJsonNamespace),
709
+ "json"
710
+ ]);
705
711
  }, _boolType => "bool", _integerType => "int64_t", _doubleType => "double", _stringType => {
706
712
  if (forceNarrowString) {
707
713
  return "std::string";
@@ -950,7 +956,17 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
950
956
  const ourQualifier = this.ourQualifier(true);
951
957
  let cppType;
952
958
  let toType;
953
- this.emitBlock(["inline void adl_serializer<", ourQualifier, className, ">::from_json(", this.withConst("json"), " & j, ", ourQualifier, className, "& x)"], false, () => {
959
+ this.emitBlock([
960
+ "inline void adl_serializer<",
961
+ ourQualifier,
962
+ className,
963
+ ">::from_json(",
964
+ this.withConst("json"),
965
+ " & j, ",
966
+ ourQualifier,
967
+ className,
968
+ "& x)"
969
+ ], false, () => {
954
970
  cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, true, false);
955
971
  toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, false, false);
956
972
  this.emitLine([
@@ -963,7 +979,14 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
963
979
  ";"
964
980
  ]);
965
981
  });
966
- this.emitBlock(["inline void adl_serializer<", ourQualifier, className, ">::to_json(json & j, ", this.withConst([ourQualifier, className]), " & x)"], false, () => {
982
+ this.emitBlock([
983
+ "inline void adl_serializer<",
984
+ ourQualifier,
985
+ className,
986
+ ">::to_json(json & j, ",
987
+ this.withConst([ourQualifier, className]),
988
+ " & x)"
989
+ ], false, () => {
967
990
  cppType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, false, false);
968
991
  toType = this.cppType(t, { needsForwardIndirection: true, needsOptionalIndirection: true, inJsonNamespace: true }, false, true, false);
969
992
  this.emitLine([
@@ -1131,7 +1154,15 @@ class CPlusPlusRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
1131
1154
  ];
1132
1155
  const nonNulls = (0, TypeUtils_1.removeNullFromUnion)(u, true)[1];
1133
1156
  const variantType = this.cppTypeInOptional(nonNulls, { needsForwardIndirection: false, needsOptionalIndirection: false, inJsonNamespace: true }, false, false);
1134
- this.emitBlock(["inline void adl_serializer<", variantType, ">::from_json(", this.withConst("json"), " & j, ", variantType, " & x)"], false, () => {
1157
+ this.emitBlock([
1158
+ "inline void adl_serializer<",
1159
+ variantType,
1160
+ ">::from_json(",
1161
+ this.withConst("json"),
1162
+ " & j, ",
1163
+ variantType,
1164
+ " & x)"
1165
+ ], false, () => {
1135
1166
  let onFirst = true;
1136
1167
  for (const [kind, func] of functionForKind) {
1137
1168
  const typeForKind = (0, collection_utils_1.iterableFind)(nonNulls, t => t.kind === kind);
@@ -58,9 +58,9 @@ class PhpTargetLanguage extends TargetLanguage_1.TargetLanguage {
58
58
  }
59
59
  get stringTypeMapping() {
60
60
  const mapping = new Map();
61
- mapping.set("date", "date"); // TODO is not implemented yet
62
- mapping.set("time", "time"); // TODO is not implemented yet
63
- mapping.set("uuid", "uuid"); // TODO is not implemented yet
61
+ mapping.set("date", "date"); // TODO is not implemented yet
62
+ mapping.set("time", "time"); // TODO is not implemented yet
63
+ mapping.set("uuid", "uuid"); // TODO is not implemented yet
64
64
  mapping.set("date-time", "date-time");
65
65
  return mapping;
66
66
  }
@@ -69,7 +69,7 @@ exports.PhpTargetLanguage = PhpTargetLanguage;
69
69
  exports.stringEscape = (0, Strings_1.utf16ConcatMap)((0, Strings_1.escapeNonPrintableMapper)(Strings_1.isAscii, Strings_1.standardUnicodeHexEscape));
70
70
  function isStartCharacter(codePoint) {
71
71
  if (codePoint === 0x5f)
72
- return true; // underscore
72
+ return true; // underscore
73
73
  return (0, Strings_1.isAscii)(codePoint) && (0, Strings_1.isLetter)(codePoint);
74
74
  }
75
75
  function isPartCharacter(codePoint) {
@@ -156,7 +156,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
156
156
  }
157
157
  }
158
158
  finishFile() {
159
- // empty
159
+ // empty
160
160
  }
161
161
  emitFileHeader(fileName, _imports) {
162
162
  this.startFile(fileName);
@@ -211,8 +211,8 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
211
211
  });
212
212
  }
213
213
  phpConvertType(className, t) {
214
- return (0, TypeUtils_1.matchType)(t, _anyType => "any", _nullType => "null", _boolType => "bool", _integerType => "int", _doubleType => "float", _stringType => "string", _arrayType => "array", _classType => "stdClass", _mapType => "stdClass", _enumType => "string", // TODO number this.nameForNamedType(enumType),
215
- // TODO number this.nameForNamedType(enumType),
214
+ return (0, TypeUtils_1.matchType)(t, _anyType => "any", _nullType => "null", _boolType => "bool", _integerType => "int", _doubleType => "float", _stringType => "string", _arrayType => "array", _classType => "stdClass", _mapType => "stdClass", _enumType => "string", // TODO number this.nameForNamedType(enumType),
215
+ // TODO number this.nameForNamedType(enumType),
216
216
  unionType => {
217
217
  const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
218
218
  if (nullable !== null) {
@@ -231,7 +231,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
231
231
  this.emitLine(...lhs, "array_map(function ($value) {");
232
232
  this.indent(() => {
233
233
  this.phpToObjConvert(className, arrayType.items, ["return "], ["$value"]);
234
- // this.emitLine("return $tmp;");
234
+ // this.emitLine("return $tmp;");
235
235
  });
236
236
  this.emitLine("}, ", ...args, ");");
237
237
  }, _classType => this.emitLine(...lhs, ...args, "->to(); ", "/*class*/"), mapType => {
@@ -264,16 +264,16 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
264
264
  }
265
265
  transformDateTime(className, attrName, scopeAttrName) {
266
266
  this.emitBlock(["if (!is_a(", scopeAttrName, ", 'DateTime'))"], () => this.emitLine("throw new Exception('Attribute Error:", className, "::", attrName, "');"));
267
- // if (lhs !== undefined) {
268
- // this.emitLine(lhs, "$tmp;");
269
- // }
267
+ // if (lhs !== undefined) {
268
+ // this.emitLine(lhs, "$tmp;");
269
+ // }
270
270
  }
271
271
  phpFromObjConvert(className, t, lhs, args) {
272
272
  return (0, TypeUtils_1.matchType)(t, _anyType => this.emitLine(...lhs, ...args, "; /*any*/"), _nullType => this.emitLine(...lhs, ...args, "; /*null*/"), _boolType => this.emitLine(...lhs, ...args, "; /*bool*/"), _integerType => this.emitLine(...lhs, ...args, "; /*int*/"), _doubleType => this.emitLine(...lhs, ...args, "; /*float*/"), _stringType => this.emitLine(...lhs, ...args, "; /*string*/"), arrayType => {
273
273
  this.emitLine(...lhs, " array_map(function ($value) {");
274
274
  this.indent(() => {
275
275
  this.phpFromObjConvert(className, arrayType.items, ["return "], ["$value"]);
276
- // this.emitLine("return $tmp;");
276
+ // this.emitLine("return $tmp;");
277
277
  });
278
278
  this.emitLine("}, ", ...args, ");");
279
279
  }, classType => this.emitLine(...lhs, this.nameForNamedType(classType), "::from(", ...args, "); ", "/*class*/"), mapType => {
@@ -331,7 +331,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
331
331
  if (transformedStringType.kind === "date-time") {
332
332
  const x = _.pad("" + (1 + (idx % 31)), 2, "0");
333
333
  this.emitLine(...lhs, "DateTime::createFromFormat(DateTimeInterface::ISO8601, '", `2020-12-${x}T12:${x}:${x}+00:00`, "')", suffix);
334
- // this.emitLine("return sample();");
334
+ // this.emitLine("return sample();");
335
335
  return;
336
336
  }
337
337
  throw Error('transformedStringType.kind === "unknown"');
@@ -381,7 +381,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
381
381
  this.emitLine(" * ", desc);
382
382
  this.emitLine(" *");
383
383
  }
384
- // this.emitLine(" * @param ", this.phpType(false, p.type, false, "", "|null"));
384
+ // this.emitLine(" * @param ", this.phpType(false, p.type, false, "", "|null"));
385
385
  this.emitLine(" * @param ", this.phpConvertType(className, p.type), " $value");
386
386
  this.emitLine(" * @throws Exception");
387
387
  this.emitLine(" * @return ", this.phpType(false, p.type));
@@ -395,7 +395,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
395
395
  this.phpType(false, p.type)
396
396
  ], () => {
397
397
  this.phpFromObjConvert(className, p.type, ["return "], [`$value`]);
398
- // this.emitLine("return $ret;");
398
+ // this.emitLine("return $ret;");
399
399
  });
400
400
  }
401
401
  emitToMethod(names, p, className, name, desc) {
@@ -594,19 +594,19 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
594
594
  this.finishFile();
595
595
  }
596
596
  emitUnionAttributes(_u, _unionName) {
597
- // empty
597
+ // empty
598
598
  }
599
599
  emitUnionSerializer(_u, _unionName) {
600
- // empty
600
+ // empty
601
601
  }
602
602
  emitUnionDefinition(_u, _unionName) {
603
603
  throw Error("emitUnionDefinition not implemented");
604
604
  }
605
605
  emitEnumSerializationAttributes(_e) {
606
- // Empty
606
+ // Empty
607
607
  }
608
608
  emitEnumDeserializationAttributes(_e) {
609
- // Empty
609
+ // Empty
610
610
  }
611
611
  emitEnumDefinition(e, enumName) {
612
612
  this.emitFileHeader(enumName, []);
@@ -647,7 +647,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
647
647
  this.emitLine("switch ($obj->enum) {");
648
648
  this.indent(() => {
649
649
  this.forEachEnumCase(e, "none", (name, jsonName) => {
650
- // Todo String or Number
650
+ // Todo String or Number
651
651
  this.emitLine("case ", enumName, "::$", name, "->enum: return '", (0, exports.stringEscape)(jsonName), "';");
652
652
  });
653
653
  });
@@ -670,7 +670,7 @@ class PhpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
670
670
  this.emitLine("switch ($obj) {");
671
671
  this.indent(() => {
672
672
  this.forEachEnumCase(e, "none", (name, jsonName) => {
673
- // Todo String or Enum
673
+ // Todo String or Enum
674
674
  this.emitLine("case '", (0, exports.stringEscape)(jsonName), "': return ", enumName, "::$", name, ";");
675
675
  });
676
676
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "20.0.22",
3
+ "version": "20.0.23",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",