@arrirpc/codegen-swift 0.69.2 → 0.71.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs CHANGED
@@ -347,8 +347,7 @@ function swiftObjectFromSchema(schema, context) {
347
347
  generatedTypes: context.generatedTypes,
348
348
  containsRequiredRef: context.containsRequiredRef
349
349
  });
350
- if (subType.content)
351
- subContent.push(subType.content);
350
+ if (subType.content) subContent.push(subType.content);
352
351
  if (subType.hasRequiredRef && !subType.isNullable) {
353
352
  context.containsRequiredRef[typeName] = true;
354
353
  result.hasRequiredRef = true;
@@ -356,8 +355,7 @@ function swiftObjectFromSchema(schema, context) {
356
355
  if (codegenUtils.isSchemaFormRef(subSchema)) {
357
356
  hasRecursiveSubType = true;
358
357
  }
359
- if (subType.canBeQueryString)
360
- canBeQueryString = true;
358
+ if (subType.canBeQueryString) canBeQueryString = true;
361
359
  const fieldName = validSwiftKey(key);
362
360
  fieldNames.push(fieldName);
363
361
  if (subType.defaultValue) {
@@ -384,8 +382,7 @@ function swiftObjectFromSchema(schema, context) {
384
382
  toJsonParts.push(` __json += "\\"${key}\\":"`);
385
383
  }
386
384
  toJsonParts.push(subType.toJsonTemplate(`self.${fieldName}`, `__json`));
387
- if (subType.canBeQueryString)
388
- canBeQueryString = true;
385
+ if (subType.canBeQueryString) canBeQueryString = true;
389
386
  toQueryStringParts.push(
390
387
  subType.toQueryPartTemplate(
391
388
  `self.${fieldName}`,
@@ -422,13 +419,11 @@ function swiftObjectFromSchema(schema, context) {
422
419
  isOptional: true,
423
420
  containsRequiredRef: context.containsRequiredRef
424
421
  });
425
- if (subType.content)
426
- subContent.push(subType.content);
422
+ if (subType.content) subContent.push(subType.content);
427
423
  if (codegenUtils.isSchemaFormRef(subSchema)) {
428
424
  hasRecursiveSubType = true;
429
425
  }
430
- if (subType.canBeQueryString)
431
- canBeQueryString = true;
426
+ if (subType.canBeQueryString) canBeQueryString = true;
432
427
  const fieldName = validSwiftKey(key);
433
428
  fieldNames.push(fieldName);
434
429
  fieldNameParts.push(
@@ -465,8 +460,7 @@ __numKeys += 1`;
465
460
  toJsonParts.push(` if self.${fieldName} != nil {
466
461
  ${toJsonContent}
467
462
  }`);
468
- if (subType.canBeQueryString)
469
- canBeQueryString = true;
463
+ if (subType.canBeQueryString) canBeQueryString = true;
470
464
  toQueryStringParts.push(
471
465
  subType.toQueryPartTemplate(
472
466
  `self.${fieldName}`,
@@ -640,8 +634,7 @@ function swiftTaggedUnionFromSchema(schema, context) {
640
634
  }
641
635
  let defaultPart;
642
636
  for (const part of discriminatorParts) {
643
- if (part.hasRequiredRef)
644
- continue;
637
+ if (part.hasRequiredRef) continue;
645
638
  defaultPart = part;
646
639
  break;
647
640
  }
@@ -1100,8 +1093,8 @@ function swiftHttpProcedureFromSchema(schema, context) {
1100
1093
  },
1101
1094
  " "
1102
1095
  );
1103
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1104
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1096
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1097
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1105
1098
  if (schema.isEventStream) {
1106
1099
  return `${comments} public func ${rpcName}(${params ? `_ params: ${params}, ` : ""}options: EventSourceOptions<${response ?? "EmptyArriModel"}>) -> Task<(), Never> {
1107
1100
  let task = Task {
@@ -1144,8 +1137,8 @@ function swiftWsProcedureFromSchema(schema, context) {
1144
1137
  "[swift-codegen] Websocket procedures are not supported at this time."
1145
1138
  );
1146
1139
  const name = getRpcName(context.instancePath);
1147
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1148
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1140
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1141
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1149
1142
  const comments = codeComments(
1150
1143
  {
1151
1144
  metadata: {
package/dist/index.mjs CHANGED
@@ -341,8 +341,7 @@ function swiftObjectFromSchema(schema, context) {
341
341
  generatedTypes: context.generatedTypes,
342
342
  containsRequiredRef: context.containsRequiredRef
343
343
  });
344
- if (subType.content)
345
- subContent.push(subType.content);
344
+ if (subType.content) subContent.push(subType.content);
346
345
  if (subType.hasRequiredRef && !subType.isNullable) {
347
346
  context.containsRequiredRef[typeName] = true;
348
347
  result.hasRequiredRef = true;
@@ -350,8 +349,7 @@ function swiftObjectFromSchema(schema, context) {
350
349
  if (isSchemaFormRef(subSchema)) {
351
350
  hasRecursiveSubType = true;
352
351
  }
353
- if (subType.canBeQueryString)
354
- canBeQueryString = true;
352
+ if (subType.canBeQueryString) canBeQueryString = true;
355
353
  const fieldName = validSwiftKey(key);
356
354
  fieldNames.push(fieldName);
357
355
  if (subType.defaultValue) {
@@ -378,8 +376,7 @@ function swiftObjectFromSchema(schema, context) {
378
376
  toJsonParts.push(` __json += "\\"${key}\\":"`);
379
377
  }
380
378
  toJsonParts.push(subType.toJsonTemplate(`self.${fieldName}`, `__json`));
381
- if (subType.canBeQueryString)
382
- canBeQueryString = true;
379
+ if (subType.canBeQueryString) canBeQueryString = true;
383
380
  toQueryStringParts.push(
384
381
  subType.toQueryPartTemplate(
385
382
  `self.${fieldName}`,
@@ -416,13 +413,11 @@ function swiftObjectFromSchema(schema, context) {
416
413
  isOptional: true,
417
414
  containsRequiredRef: context.containsRequiredRef
418
415
  });
419
- if (subType.content)
420
- subContent.push(subType.content);
416
+ if (subType.content) subContent.push(subType.content);
421
417
  if (isSchemaFormRef(subSchema)) {
422
418
  hasRecursiveSubType = true;
423
419
  }
424
- if (subType.canBeQueryString)
425
- canBeQueryString = true;
420
+ if (subType.canBeQueryString) canBeQueryString = true;
426
421
  const fieldName = validSwiftKey(key);
427
422
  fieldNames.push(fieldName);
428
423
  fieldNameParts.push(
@@ -459,8 +454,7 @@ __numKeys += 1`;
459
454
  toJsonParts.push(` if self.${fieldName} != nil {
460
455
  ${toJsonContent}
461
456
  }`);
462
- if (subType.canBeQueryString)
463
- canBeQueryString = true;
457
+ if (subType.canBeQueryString) canBeQueryString = true;
464
458
  toQueryStringParts.push(
465
459
  subType.toQueryPartTemplate(
466
460
  `self.${fieldName}`,
@@ -634,8 +628,7 @@ function swiftTaggedUnionFromSchema(schema, context) {
634
628
  }
635
629
  let defaultPart;
636
630
  for (const part of discriminatorParts) {
637
- if (part.hasRequiredRef)
638
- continue;
631
+ if (part.hasRequiredRef) continue;
639
632
  defaultPart = part;
640
633
  break;
641
634
  }
@@ -1094,8 +1087,8 @@ function swiftHttpProcedureFromSchema(schema, context) {
1094
1087
  },
1095
1088
  " "
1096
1089
  );
1097
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1098
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1090
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1091
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1099
1092
  if (schema.isEventStream) {
1100
1093
  return `${comments} public func ${rpcName}(${params ? `_ params: ${params}, ` : ""}options: EventSourceOptions<${response ?? "EmptyArriModel"}>) -> Task<(), Never> {
1101
1094
  let task = Task {
@@ -1138,8 +1131,8 @@ function swiftWsProcedureFromSchema(schema, context) {
1138
1131
  "[swift-codegen] Websocket procedures are not supported at this time."
1139
1132
  );
1140
1133
  const name = getRpcName(context.instancePath);
1141
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1142
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1134
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1135
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1143
1136
  const comments = codeComments(
1144
1137
  {
1145
1138
  metadata: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-swift",
3
- "version": "0.69.2",
3
+ "version": "0.71.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@arrirpc/codegen-utils": "0.69.2"
25
+ "@arrirpc/codegen-utils": "0.71.0"
26
26
  },
27
27
  "devDependencies": {}
28
28
  }