@arrirpc/codegen-kotlin 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
@@ -394,8 +394,9 @@ ${isLast ? "" : " hasProperties = true"}
394
394
  override val ${kotlinIdentifier(context.discriminatorKey)} get() = "${context.discriminatorValue}"
395
395
  `;
396
396
  }
397
+ const hasProperties = fieldParts.length > 0;
397
398
  const content = `${getCodeComment(schema.metadata, "", "class")}data class ${prefixedClassName}(
398
- ${fieldParts.join("\n")}
399
+ ${fieldParts.join("\n")}${!hasProperties ? " private val placeholderKey: Short = 0" : ""}
399
400
  ) : ${implementedClass} {${discriminatorField}
400
401
  override fun toJson(): String {
401
402
  ${toJsonParts.join("\n")}
@@ -426,7 +427,7 @@ ${defaultParts.join("\n")}
426
427
  }
427
428
  ${fromJsonParts.join("\n")}
428
429
  return ${prefixedClassName}(
429
- ${kotlinKeys.join(",\n ")},
430
+ ${kotlinKeys.join(",\n ")}${hasProperties ? `,` : ""}
430
431
  )
431
432
  }
432
433
  }
@@ -1151,8 +1152,8 @@ function kotlinProcedureFromSchema(schema, context) {
1151
1152
  }
1152
1153
  function kotlinHttpRpcFromSchema(schema, context) {
1153
1154
  const name = getProcedureName(context);
1154
- const params = schema.params ? kotlinClassName(`${context.typePrefix}_${schema.params}`) : undefined;
1155
- const response = schema.response ? kotlinClassName(`${context.typePrefix}_${schema.response}`) : undefined;
1155
+ const params = schema.params ? kotlinClassName(`${context.typePrefix}_${schema.params}`) : void 0;
1156
+ const response = schema.response ? kotlinClassName(`${context.typePrefix}_${schema.response}`) : void 0;
1156
1157
  const codeComment = getCodeComment(
1157
1158
  {
1158
1159
  description: schema.description,
package/dist/index.mjs CHANGED
@@ -388,8 +388,9 @@ ${isLast ? "" : " hasProperties = true"}
388
388
  override val ${kotlinIdentifier(context.discriminatorKey)} get() = "${context.discriminatorValue}"
389
389
  `;
390
390
  }
391
+ const hasProperties = fieldParts.length > 0;
391
392
  const content = `${getCodeComment(schema.metadata, "", "class")}data class ${prefixedClassName}(
392
- ${fieldParts.join("\n")}
393
+ ${fieldParts.join("\n")}${!hasProperties ? " private val placeholderKey: Short = 0" : ""}
393
394
  ) : ${implementedClass} {${discriminatorField}
394
395
  override fun toJson(): String {
395
396
  ${toJsonParts.join("\n")}
@@ -420,7 +421,7 @@ ${defaultParts.join("\n")}
420
421
  }
421
422
  ${fromJsonParts.join("\n")}
422
423
  return ${prefixedClassName}(
423
- ${kotlinKeys.join(",\n ")},
424
+ ${kotlinKeys.join(",\n ")}${hasProperties ? `,` : ""}
424
425
  )
425
426
  }
426
427
  }
@@ -1145,8 +1146,8 @@ function kotlinProcedureFromSchema(schema, context) {
1145
1146
  }
1146
1147
  function kotlinHttpRpcFromSchema(schema, context) {
1147
1148
  const name = getProcedureName(context);
1148
- const params = schema.params ? kotlinClassName(`${context.typePrefix}_${schema.params}`) : undefined;
1149
- const response = schema.response ? kotlinClassName(`${context.typePrefix}_${schema.response}`) : undefined;
1149
+ const params = schema.params ? kotlinClassName(`${context.typePrefix}_${schema.params}`) : void 0;
1150
+ const response = schema.response ? kotlinClassName(`${context.typePrefix}_${schema.response}`) : void 0;
1150
1151
  const codeComment = getCodeComment(
1151
1152
  {
1152
1153
  description: schema.description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-kotlin",
3
- "version": "0.74.1",
3
+ "version": "0.75.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -22,6 +22,6 @@
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
  }