quicktype-core 23.0.42 → 23.0.43

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.
@@ -10,6 +10,7 @@ export declare const goOptions: {
10
10
  justTypesAndPackage: BooleanOption;
11
11
  packageName: StringOption;
12
12
  multiFileOutput: BooleanOption;
13
+ fieldTags: StringOption;
13
14
  };
14
15
  export declare class GoTargetLanguage extends TargetLanguage {
15
16
  constructor();
@@ -15,14 +15,21 @@ exports.goOptions = {
15
15
  justTypes: new RendererOptions_1.BooleanOption("just-types", "Plain types only", false),
16
16
  justTypesAndPackage: new RendererOptions_1.BooleanOption("just-types-and-package", "Plain types with package only", false),
17
17
  packageName: new RendererOptions_1.StringOption("package", "Generated package name", "NAME", "main"),
18
- multiFileOutput: new RendererOptions_1.BooleanOption("multi-file-output", "Renders each top-level object in its own Go file", false)
18
+ multiFileOutput: new RendererOptions_1.BooleanOption("multi-file-output", "Renders each top-level object in its own Go file", false),
19
+ fieldTags: new RendererOptions_1.StringOption("field-tags", "list of tags which should be generated for fields", "TAGS", "json")
19
20
  };
20
21
  class GoTargetLanguage extends TargetLanguage_1.TargetLanguage {
21
22
  constructor() {
22
23
  super("Go", ["go", "golang"], "go");
23
24
  }
24
25
  getOptions() {
25
- return [exports.goOptions.justTypes, exports.goOptions.packageName, exports.goOptions.multiFileOutput, exports.goOptions.justTypesAndPackage];
26
+ return [
27
+ exports.goOptions.justTypes,
28
+ exports.goOptions.packageName,
29
+ exports.goOptions.multiFileOutput,
30
+ exports.goOptions.justTypesAndPackage,
31
+ exports.goOptions.fieldTags
32
+ ];
26
33
  }
27
34
  get supportsUnionsWithBothNumberTypes() {
28
35
  return true;
@@ -189,10 +196,14 @@ class GoRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
189
196
  const goType = this.propertyGoType(p);
190
197
  const omitEmpty = canOmitEmpty(p) ? ",omitempty" : [];
191
198
  docStrings.forEach(doc => columns.push([doc]));
199
+ const tags = this._options.fieldTags
200
+ .split(",")
201
+ .map(tag => tag + ':"' + (0, Strings_1.stringEscape)(jsonName) + omitEmpty + '"')
202
+ .join(" ");
192
203
  columns.push([
193
204
  [name, " "],
194
205
  [goType, " "],
195
- ['`json:"', (0, Strings_1.stringEscape)(jsonName), omitEmpty, '"`']
206
+ ["`", tags, "`"]
196
207
  ]);
197
208
  });
198
209
  this.emitDescription(this.descriptionForType(c));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.0.42",
3
+ "version": "23.0.43",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",