quicktype-core 23.2.2 → 23.2.4

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.
@@ -54,7 +54,7 @@ const is_url_1 = __importDefault(require("is-url"));
54
54
  const Messages_1 = require("../../Messages");
55
55
  const Support_1 = require("../../support/Support");
56
56
  const get_stream_1 = require("./get-stream");
57
- const _fetch_ci_1 = require("./$fetch.ci");
57
+ const _fetch_1 = require("./$fetch");
58
58
  function parseHeaders(httpHeaders) {
59
59
  if (!Array.isArray(httpHeaders)) {
60
60
  return {};
@@ -76,7 +76,7 @@ function readableFromFileOrURL(fileOrURL, httpHeaders) {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
77
  try {
78
78
  if ((0, is_url_1.default)(fileOrURL)) {
79
- const response = yield (0, _fetch_ci_1.fetch)(fileOrURL, {
79
+ const response = yield (0, _fetch_1.fetch)(fileOrURL, {
80
80
  headers: parseHeaders(httpHeaders),
81
81
  });
82
82
  return (0, ts_necessities_1.defined)(response.body);
@@ -42,4 +42,5 @@ export declare class CSharpRenderer extends ConvenienceRenderer {
42
42
  protected emitDefaultFollowingComments(): void;
43
43
  protected needNamespace(): boolean;
44
44
  protected emitSourceStructure(): void;
45
+ protected emitDependencyUsings(): void;
45
46
  }
@@ -333,5 +333,17 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
333
333
  }
334
334
  this.emitDefaultFollowingComments();
335
335
  }
336
+ emitDependencyUsings() {
337
+ let genericEmited = false;
338
+ let ensureGenericOnce = () => {
339
+ if (!genericEmited) {
340
+ this.emitUsing("System.Collections.Generic");
341
+ genericEmited = true;
342
+ }
343
+ };
344
+ this.typeGraph.allTypesUnordered().forEach(_ => {
345
+ (0, TypeUtils_1.matchCompoundType)(_, _arrayType => this._csOptions.useList ? ensureGenericOnce() : undefined, _classType => { }, _mapType => ensureGenericOnce(), _objectType => { }, _unionType => { });
346
+ });
347
+ }
336
348
  }
337
349
  exports.CSharpRenderer = CSharpRenderer;
@@ -67,9 +67,10 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer_1.CSharpRenderer {
67
67
  return [extensionsName];
68
68
  }
69
69
  emitUsings() {
70
- // FIXME: We need System.Collections.Generic whenever we have maps or use List.
71
- if (!this._needAttributes && !this._needHelpers)
70
+ if (!this._needAttributes && !this._needHelpers) {
71
+ this.emitDependencyUsings();
72
72
  return;
73
+ }
73
74
  super.emitUsings();
74
75
  this.ensureBlankLine();
75
76
  for (const ns of [
@@ -68,9 +68,10 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer_1.CSharpRenderer {
68
68
  return [extensionsName];
69
69
  }
70
70
  emitUsings() {
71
- // FIXME: We need System.Collections.Generic whenever we have maps or use List.
72
- if (!this._needAttributes && !this._needHelpers)
71
+ if (!this._needAttributes && !this._needHelpers) {
72
+ this.emitDependencyUsings();
73
73
  return;
74
+ }
74
75
  super.emitUsings();
75
76
  this.ensureBlankLine();
76
77
  for (const ns of [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.2.2",
3
+ "version": "23.2.4",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",