From c2e7a1af5d0e448dc8325f80a8ad3f68b7395d8c Mon Sep 17 00:00:00 2001 From: Joshua Sosso Date: Thu, 5 Sep 2024 16:41:29 -0500 Subject: [PATCH 1/2] fix broken int64 and uint64 serialization --- languages/kotlin/kotlin-codegen/src/primitives.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/languages/kotlin/kotlin-codegen/src/primitives.ts b/languages/kotlin/kotlin-codegen/src/primitives.ts index ecdf99b9..492fb74b 100644 --- a/languages/kotlin/kotlin-codegen/src/primitives.ts +++ b/languages/kotlin/kotlin-codegen/src/primitives.ts @@ -342,11 +342,11 @@ export function kotlinInt64FromSchema( toJson(input, target) { if (schema.nullable) { return `${target} += when (${input}) { - is Long -> "\\"$${input}\\"" + is Long -> "\\"\${${input}}\\"" else -> "null" }`; } - return `${target} += "\\"$${input}\\""`; + return `${target} += "\\"\${${input}}\\""`; }, toQueryString(input, target, key) { return defaultToQueryString(context, input, target, key); @@ -476,11 +476,11 @@ export function kotlinUint64FromSchema( toJson(input, target) { if (schema.nullable) { return `${target} += when (${input}) { - is ULong -> "\\"$${input}\\"" + is ULong -> "\\"\${${input}}\\"" else -> "null" }`; } - return `${target} += "\\"$${input}\\""`; + return `${target} += "\\"\${${input}}\\""`; }, toQueryString(input, target, key) { return defaultToQueryString(context, input, target, key); From 890361fa320ce6db7f61dace63df542181b5814b Mon Sep 17 00:00:00 2001 From: Joshua Sosso Date: Thu, 5 Sep 2024 16:41:39 -0500 Subject: [PATCH 2/2] fix broken tests --- .../src/main/kotlin/ExampleClient.kt | 12 +-- tests/clients/dart/pubspec.lock | 87 +++++++++++-------- tests/clients/dart/pubspec.yaml | 2 +- .../kotlin/src/main/kotlin/TestClient.rpc.kt | 22 ++--- 4 files changed, 68 insertions(+), 55 deletions(-) diff --git a/languages/kotlin/kotlin-codegen-reference/src/main/kotlin/ExampleClient.kt b/languages/kotlin/kotlin-codegen-reference/src/main/kotlin/ExampleClient.kt index 61442779..b32f8003 100644 --- a/languages/kotlin/kotlin-codegen-reference/src/main/kotlin/ExampleClient.kt +++ b/languages/kotlin/kotlin-codegen-reference/src/main/kotlin/ExampleClient.kt @@ -531,9 +531,9 @@ data class ObjectWithEveryType( output += ",\"uint32\":" output += uint32 output += ",\"int64\":" - output += "\"$int64\"" + output += "\"${int64}\"" output += ",\"uint64\":" - output += "\"$uint64\"" + output += "\"${uint64}\"" output += ",\"enum\":" output += "\"${enum.serialValue}\"" output += ",\"object\":" @@ -1131,13 +1131,13 @@ data class ObjectWithOptionalFields( if (int64 != null) { if (hasProperties) output += "," output += "\"int64\":" - output += "\"$int64\"" + output += "\"${int64}\"" hasProperties = true } if (uint64 != null) { if (hasProperties) output += "," output += "\"uint64\":" - output += "\"$uint64\"" + output += "\"${uint64}\"" hasProperties = true } if (enum != null) { @@ -1460,12 +1460,12 @@ data class ObjectWithNullableFields( output += uint32 output += ",\"int64\":" output += when (int64) { - is Long -> "\"$int64\"" + is Long -> "\"${int64}\"" else -> "null" } output += ",\"uint64\":" output += when (uint64) { - is ULong -> "\"$uint64\"" + is ULong -> "\"${uint64}\"" else -> "null" } output += ",\"enum\":" diff --git a/tests/clients/dart/pubspec.lock b/tests/clients/dart/pubspec.lock index 903cad46..243cf345 100644 --- a/tests/clients/dart/pubspec.lock +++ b/tests/clients/dart/pubspec.lock @@ -5,26 +5,31 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: "45cfa8471b89fb6643fe9bf51bd7931a76b8f5ec2d65de4fb176dba8d4f22c77" url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "73.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" analyzer: dependency: transitive description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: "4959fec185fe70cce007c57e9ab6983101dbe593d2bf8bbfb4453aaec0cf470a" url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "6.8.0" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" arri_client: dependency: "direct main" description: @@ -52,10 +57,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" convert: dependency: transitive description: @@ -68,18 +73,18 @@ packages: dependency: transitive description: name: coverage - sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + sha256: c1fb2dce3c0085f39dc72668e85f8e0210ec7de05345821ff58530567df345a5 url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.9.2" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.5" file: dependency: transitive description: @@ -92,10 +97,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "4.0.0" glob: dependency: transitive description: @@ -108,10 +113,10 @@ packages: dependency: transitive description: name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.2" http_multi_server: dependency: transitive description: @@ -124,10 +129,10 @@ packages: dependency: transitive description: name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + sha256: "40f592dd352890c3b60fec1b68e786cefb9603e05ff303dbc4dda49b304ecdf4" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.1.0" io: dependency: transitive description: @@ -160,6 +165,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + url: "https://pub.dev" + source: hosted + version: "0.1.2-main.4" matcher: dependency: transitive description: @@ -180,10 +193,10 @@ packages: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" node_preamble: dependency: transitive description: @@ -228,10 +241,10 @@ packages: dependency: transitive description: name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.4.2" shelf_packages_handler: dependency: transitive description: @@ -260,10 +273,10 @@ packages: dependency: transitive description: name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" source_maps: dependency: transitive description: @@ -300,10 +313,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" term_glyph: dependency: transitive description: @@ -316,26 +329,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "47e9b601e20f24c27d08002eb635e92ddc2195010a8b3a621f4ed44ef70f6864" + sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" url: "https://pub.dev" source: hosted - version: "1.25.6" + version: "1.25.8" test_api: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" test_core: dependency: transitive description: name: test_core - sha256: "0c583123c86e58ab5036c92db5c7116ffddd655f1f5be762967d09f0fc66bf2d" + sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" url: "https://pub.dev" source: hosted - version: "0.6.3" + version: "0.6.5" typed_data: dependency: transitive description: @@ -348,10 +361,10 @@ packages: dependency: transitive description: name: vm_service - sha256: a2662fb1f114f4296cf3f5a50786a2d888268d7776cf681aa17d660ffa23b246 + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "14.0.0" + version: "14.2.5" watcher: dependency: transitive description: @@ -364,10 +377,10 @@ packages: dependency: transitive description: name: web - sha256: "1d9158c616048c38f712a6646e317a3426da10e884447626167240d45209cbad" + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "1.0.0" web_socket: dependency: transitive description: @@ -401,4 +414,4 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" diff --git a/tests/clients/dart/pubspec.yaml b/tests/clients/dart/pubspec.yaml index e7c28b61..d91ae318 100644 --- a/tests/clients/dart/pubspec.yaml +++ b/tests/clients/dart/pubspec.yaml @@ -9,4 +9,4 @@ dependencies: path: ../../../languages/dart/dart-client dev_dependencies: lints: ^4.0.0 - test: ^1.25.6 + test: ^1.25.8 diff --git a/tests/clients/kotlin/src/main/kotlin/TestClient.rpc.kt b/tests/clients/kotlin/src/main/kotlin/TestClient.rpc.kt index 5303fc10..ad2f6e9a 100644 --- a/tests/clients/kotlin/src/main/kotlin/TestClient.rpc.kt +++ b/tests/clients/kotlin/src/main/kotlin/TestClient.rpc.kt @@ -886,9 +886,9 @@ output += int32 output += ",\"uint32\":" output += uint32 output += ",\"int64\":" -output += "\"$int64\"" +output += "\"${int64}\"" output += ",\"uint64\":" -output += "\"$uint64\"" +output += "\"${uint64}\"" output += ",\"enumerator\":" output += "\"${enumerator.serialValue}\"" output += ",\"array\":" @@ -909,7 +909,7 @@ output += "{" output += "," } output += "\"${__entry.key}\":" - output += "\"$__entry.value\"" + output += "\"${__entry.value}\"" } output += "}" output += ",\"discriminator\":" @@ -1803,12 +1803,12 @@ output += ",\"uint32\":" output += uint32 output += ",\"int64\":" output += when (int64) { - is Long -> "\"$int64\"" + is Long -> "\"${int64}\"" else -> "null" } output += ",\"uint64\":" output += when (uint64) { - is ULong -> "\"$uint64\"" + is ULong -> "\"${uint64}\"" else -> "null" } output += ",\"enumerator\":" @@ -1842,7 +1842,7 @@ if (record == null) { } output += "\"${__entry.key}\":" output += when (__entry.value) { - is ULong -> "\"$__entry.value\"" + is ULong -> "\"${__entry.value}\"" else -> "null" } } @@ -2852,14 +2852,14 @@ if (int64 != null) { if (hasProperties) output += "," output += "\"int64\":" - output += "\"$int64\"" + output += "\"${int64}\"" hasProperties = true } if (uint64 != null) { if (hasProperties) output += "," output += "\"uint64\":" - output += "\"$uint64\"" + output += "\"${uint64}\"" hasProperties = true } if (enumerator != null) { @@ -2900,7 +2900,7 @@ if (record != null) { output += "," } output += "\"${__entry.key}\":" - output += "\"$__entry.value\"" + output += "\"${__entry.value}\"" } output += "}" hasProperties = true @@ -5778,9 +5778,9 @@ output += width output += ",\"height\":" output += height output += ",\"bytes\":" -output += "\"$bytes\"" +output += "\"${bytes}\"" output += ",\"nanoseconds\":" -output += "\"$nanoseconds\"" +output += "\"${nanoseconds}\"" output += "}" return output }