@arrirpc/codegen-swift 0.74.1 → 0.75.0

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.
package/dist/index.cjs CHANGED
@@ -494,6 +494,7 @@ __numKeys += 1`;
494
494
  ${fieldNames.map((field) => ` lhs.${field} == rhs.${field}`).join(" &&\n")}
495
495
  }`;
496
496
  }
497
+ const hasProperties = initArgParts.length > 0;
497
498
  result.content = `${codeComments(schema)}public ${declaration} ${prefixedTypeName}: ArriClientModel {
498
499
  ${fieldNameParts.join("\n")}
499
500
  ${initPrefix} init(
@@ -501,7 +502,7 @@ ${initArgParts.join(",\n")}
501
502
  ) {
502
503
  ${initBodyParts.join("\n")}
503
504
  }
504
- ${initPrefix} init() {}
505
+ ${hasProperties ? `${initPrefix} init() {}` : ""}
505
506
  ${initPrefix} init(json: JSON) {
506
507
  ${initFromJsonParts.join("\n")}
507
508
  }
@@ -1093,8 +1094,8 @@ function swiftHttpProcedureFromSchema(schema, context) {
1093
1094
  },
1094
1095
  " "
1095
1096
  );
1096
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1097
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1097
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1098
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1098
1099
  if (schema.isEventStream) {
1099
1100
  return `${comments} public func ${rpcName}(${params ? `_ params: ${params}, ` : ""}options: EventSourceOptions<${response ?? "EmptyArriModel"}>) -> Task<(), Never> {
1100
1101
  let task = Task {
@@ -1137,8 +1138,8 @@ function swiftWsProcedureFromSchema(schema, context) {
1137
1138
  "[swift-codegen] Websocket procedures are not supported at this time."
1138
1139
  );
1139
1140
  const name = getRpcName(context.instancePath);
1140
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1141
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1141
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1142
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1142
1143
  const comments = codeComments(
1143
1144
  {
1144
1145
  metadata: {
package/dist/index.mjs CHANGED
@@ -488,6 +488,7 @@ __numKeys += 1`;
488
488
  ${fieldNames.map((field) => ` lhs.${field} == rhs.${field}`).join(" &&\n")}
489
489
  }`;
490
490
  }
491
+ const hasProperties = initArgParts.length > 0;
491
492
  result.content = `${codeComments(schema)}public ${declaration} ${prefixedTypeName}: ArriClientModel {
492
493
  ${fieldNameParts.join("\n")}
493
494
  ${initPrefix} init(
@@ -495,7 +496,7 @@ ${initArgParts.join(",\n")}
495
496
  ) {
496
497
  ${initBodyParts.join("\n")}
497
498
  }
498
- ${initPrefix} init() {}
499
+ ${hasProperties ? `${initPrefix} init() {}` : ""}
499
500
  ${initPrefix} init(json: JSON) {
500
501
  ${initFromJsonParts.join("\n")}
501
502
  }
@@ -1087,8 +1088,8 @@ function swiftHttpProcedureFromSchema(schema, context) {
1087
1088
  },
1088
1089
  " "
1089
1090
  );
1090
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1091
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1091
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1092
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1092
1093
  if (schema.isEventStream) {
1093
1094
  return `${comments} public func ${rpcName}(${params ? `_ params: ${params}, ` : ""}options: EventSourceOptions<${response ?? "EmptyArriModel"}>) -> Task<(), Never> {
1094
1095
  let task = Task {
@@ -1131,8 +1132,8 @@ function swiftWsProcedureFromSchema(schema, context) {
1131
1132
  "[swift-codegen] Websocket procedures are not supported at this time."
1132
1133
  );
1133
1134
  const name = getRpcName(context.instancePath);
1134
- const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : undefined;
1135
- const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : undefined;
1135
+ const params = schema.params ? `${context.typePrefix}${validTypeName(schema.params)}` : void 0;
1136
+ const response = schema.response ? `${context.typePrefix}${validTypeName(schema.response)}` : void 0;
1136
1137
  const comments = codeComments(
1137
1138
  {
1138
1139
  metadata: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-swift",
3
- "version": "0.74.1",
3
+ "version": "0.75.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.74.1"
25
+ "@arrirpc/codegen-utils": "0.75.0"
26
26
  },
27
27
  "devDependencies": {}
28
28
  }