From 679ab36a67c701bcdb19163b488a9c27f8bb814b Mon Sep 17 00:00:00 2001 From: Wahab Alshahin Date: Fri, 15 Sep 2023 16:15:18 -0400 Subject: [PATCH] Ensure query parameters are stringified --- CHANGELOG.md | 3 ++- lib/src/generators/client.dart | 9 +++++++++ pubspec.yaml | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e6de8b..52ca750 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -## 0.5.8 +## 0.5.9 +* Ensure query parameters are stringified * Allow URI construction to handle query parameter encoding ## 0.5.7 diff --git a/lib/src/generators/client.dart b/lib/src/generators/client.dart index 950ac4d..4f8469f 100644 --- a/lib/src/generators/client.dart +++ b/lib/src/generators/client.dart @@ -243,6 +243,15 @@ class $clientName { ); } + // Ensure query parameters are strings or iterable of strings + queryParams = queryParams.map((key, value) { + if (value is List) { + return MapEntry(key, value.map((v) => v.toString())); + } else { + return MapEntry(key, value.toString()); + } + }); + // Build the request URI final secure = Uri.parse(host).scheme == 'https'; Uri uri; diff --git a/pubspec.yaml b/pubspec.yaml index f95e873..25ea8c5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: openapi_spec description: OpenAPI Specification generator using native Dart code, as well as an all-in-one parser of existing specifications. -version: 0.5.8 +version: 0.5.9 maintainer: Taza Technology LLC repository: https://github.com/tazatechnology/openapi_spec issue_tracker: https://github.com/tazatechnology/openapi_spec/issues