quicktype-core 23.2.3 → 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.
@@ -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.3",
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",