quicktype-core 23.0.89 → 23.0.91

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.
@@ -38,6 +38,7 @@ export declare const cSharpOptions: {
38
38
  }>;
39
39
  baseclass: EnumOption<string | undefined>;
40
40
  checkRequired: BooleanOption;
41
+ keepPropertyName: BooleanOption;
41
42
  };
42
43
  export declare class CSharpTargetLanguage extends TargetLanguage {
43
44
  constructor();
@@ -102,6 +103,7 @@ export declare const newtonsoftCSharpOptions: {
102
103
  }>;
103
104
  baseclass: EnumOption<string | undefined>;
104
105
  checkRequired: BooleanOption;
106
+ keepPropertyName: BooleanOption;
105
107
  };
106
108
  export declare class NewtonsoftCSharpRenderer extends CSharpRenderer {
107
109
  private readonly _options;
@@ -158,6 +160,7 @@ export declare const systemTextJsonCSharpOptions: {
158
160
  }>;
159
161
  baseclass: EnumOption<string | undefined>;
160
162
  checkRequired: BooleanOption;
163
+ keepPropertyName: BooleanOption;
161
164
  };
162
165
  export declare class SystemTextJsonCSharpRenderer extends CSharpRenderer {
163
166
  private readonly _options;
@@ -119,7 +119,8 @@ exports.cSharpOptions = {
119
119
  ["EntityData", "EntityData"],
120
120
  ["Object", undefined]
121
121
  ], "Object", "secondary"),
122
- checkRequired: new RendererOptions_1.BooleanOption("check-required", "Fail if required properties are missing", false)
122
+ checkRequired: new RendererOptions_1.BooleanOption("check-required", "Fail if required properties are missing", false),
123
+ keepPropertyName: new RendererOptions_1.BooleanOption("keep-property-name", "Keep original field name generate", false),
123
124
  };
124
125
  class CSharpTargetLanguage extends TargetLanguage_1.TargetLanguage {
125
126
  constructor() {
@@ -137,7 +138,8 @@ class CSharpTargetLanguage extends TargetLanguage_1.TargetLanguage {
137
138
  exports.cSharpOptions.virtual,
138
139
  exports.cSharpOptions.features,
139
140
  exports.cSharpOptions.baseclass,
140
- exports.cSharpOptions.checkRequired
141
+ exports.cSharpOptions.checkRequired,
142
+ exports.cSharpOptions.keepPropertyName
141
143
  ];
142
144
  }
143
145
  get stringTypeMapping() {
@@ -175,6 +177,7 @@ class CSharpTargetLanguage extends TargetLanguage_1.TargetLanguage {
175
177
  }
176
178
  exports.CSharpTargetLanguage = CSharpTargetLanguage;
177
179
  const namingFunction = (0, Naming_1.funPrefixNamer)("namer", csNameStyle);
180
+ const namingFunctionKeep = (0, Naming_1.funPrefixNamer)("namerKeep", csNameStyleKeep);
178
181
  // FIXME: Make a Named?
179
182
  const denseJsonPropertyName = "J";
180
183
  const denseRequiredEnumName = "R";
@@ -197,6 +200,95 @@ function csNameStyle(original) {
197
200
  const words = (0, Strings_1.splitIntoWords)(original);
198
201
  return (0, Strings_1.combineWords)(words, legalizeName, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, "", isStartCharacter);
199
202
  }
203
+ function csNameStyleKeep(original) {
204
+ const keywords = [
205
+ "abstract",
206
+ "as",
207
+ "base",
208
+ "bool",
209
+ "break",
210
+ "byte",
211
+ "case",
212
+ "catch",
213
+ "char",
214
+ "checked",
215
+ "class",
216
+ "const",
217
+ "continue",
218
+ "decimal",
219
+ "default",
220
+ "delegate",
221
+ "do",
222
+ "double",
223
+ "else",
224
+ "enum",
225
+ "event",
226
+ "explicit",
227
+ "extern",
228
+ "false",
229
+ "finally",
230
+ "fixed",
231
+ "float",
232
+ "for",
233
+ "foreach",
234
+ "goto",
235
+ "if",
236
+ "implicit",
237
+ "in",
238
+ "int",
239
+ "interface",
240
+ "internal",
241
+ "is",
242
+ "lock",
243
+ "long",
244
+ "namespace",
245
+ "new",
246
+ "null",
247
+ "object",
248
+ "operator",
249
+ "out",
250
+ "override",
251
+ "params",
252
+ "private",
253
+ "protected",
254
+ "public",
255
+ "readonly",
256
+ "ref",
257
+ "return",
258
+ "sbyte",
259
+ "sealed",
260
+ "short",
261
+ "sizeof",
262
+ "stackalloc",
263
+ "static",
264
+ "string",
265
+ "struct",
266
+ "switch",
267
+ "this",
268
+ "throw",
269
+ "true",
270
+ "try",
271
+ "typeof",
272
+ "uint",
273
+ "ulong",
274
+ "unchecked",
275
+ "unsafe",
276
+ "ushort",
277
+ "using",
278
+ "virtual",
279
+ "void",
280
+ "volatile",
281
+ "while",
282
+ ];
283
+ const words = [
284
+ {
285
+ word: original,
286
+ isAcronym: false
287
+ }
288
+ ];
289
+ const result = (0, Strings_1.combineWords)(words, legalizeName, x => x, x => x, x => x, x => x, "", isStartCharacter);
290
+ return keywords.includes(result) ? "@" + result : result;
291
+ }
200
292
  function isValueType(t) {
201
293
  if (t instanceof Type_1.UnionType) {
202
294
  return (0, TypeUtils_1.nullableFromUnion)(t) === null;
@@ -233,7 +325,7 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
233
325
  return namingFunction;
234
326
  }
235
327
  namerForObjectProperty() {
236
- return namingFunction;
328
+ return this._csOptions.keepPropertyName ? namingFunctionKeep : namingFunction;
237
329
  }
238
330
  makeUnionMemberNamer() {
239
331
  return namingFunction;
@@ -29,7 +29,8 @@ class GoTargetLanguage extends TargetLanguage_1.TargetLanguage {
29
29
  exports.goOptions.packageName,
30
30
  exports.goOptions.multiFileOutput,
31
31
  exports.goOptions.justTypesAndPackage,
32
- exports.goOptions.fieldTags
32
+ exports.goOptions.fieldTags,
33
+ exports.goOptions.omitEmpty
33
34
  ];
34
35
  }
35
36
  get supportsUnionsWithBothNumberTypes() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quicktype-core",
3
- "version": "23.0.89",
3
+ "version": "23.0.91",
4
4
  "description": "The quicktype engine as a library",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",