Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: fix parsing/serialization bug when map values are uint64 or int64 #97

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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\":"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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\":"
Expand Down
8 changes: 4 additions & 4 deletions languages/kotlin/kotlin-codegen/src/primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
87 changes: 50 additions & 37 deletions tests/clients/dart/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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"
2 changes: 1 addition & 1 deletion tests/clients/dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ dependencies:
path: ../../../languages/dart/dart-client
dev_dependencies:
lints: ^4.0.0
test: ^1.25.6
test: ^1.25.8
Loading
Loading