From ed62772355ccbaf2d2eb2eb84a43d2258897d5cf Mon Sep 17 00:00:00 2001 From: Michael Faille Date: Mon, 13 Jan 2025 14:12:16 -0800 Subject: [PATCH] Fix: Resolve Dart 3.5+ and json_serializable 6.9.0+ compatibility issues in generated dart-dio clients This commit fixes compatibility problems between the generated dart-dio code, json_serializable 6.9.0+, and Dart SDK 3.5 or later. Changes: - Updated `pubspec.mustache`: - Set the minimum SDK constraint for the generated package to `>=3.5.0 <4.0.0`, reflecting the language version used in the generated code. - Bump `json_annotation` dependency to `^4.9.0`. - Bump `json_serializable` dependency to `^6.9.0`. These changes ensure that the generated code: - Is compatible with `json_serializable` 6.9.0+ and Dart SDK 3.5+. - Avoids Dart 3.5+ specific syntax that causes errors on older SDKs. - Maintains existing functionality and type safety. Resolves: #16117 --- .../resources/dart/libraries/dio/pubspec.mustache | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache index 5a93026402d26..8a91f874bc3c5 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache @@ -9,11 +9,12 @@ repository: {{.}} publish_to: {{.}} {{/pubPublishTo}} + environment: - sdk: '>={{#useJsonSerializable}}2.17.0{{/useJsonSerializable}}{{^useJsonSerializable}}2.15.0{{/useJsonSerializable}} <4.0.0' + sdk: '>={{^useJsonSerializable}}2.18.0{{/useJsonSerializable}}{{#useJsonSerializable}}3.5.0{{/useJsonSerializable}} <4.0.0' dependencies: - dio: '^5.2.0' + dio: '^5.7.0' {{#useBuiltValue}} one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' @@ -21,13 +22,13 @@ dependencies: built_collection: '>=5.1.1 <6.0.0' {{/useBuiltValue}} {{#useEquatable}} - equatable: '^2.0.5' + equatable: '^2.0.7' {{/useEquatable}} {{#useJsonSerializable}} - json_annotation: '^4.4.0' + json_annotation: '^4.9.0' {{/useJsonSerializable}} {{#useDateLibTimeMachine}} - time_machine: ^0.9.16 + time_machine: ^0.9.17 {{/useDateLibTimeMachine}} dev_dependencies: @@ -37,6 +38,6 @@ dev_dependencies: {{/useBuiltValue}} {{#useJsonSerializable}} build_runner: any - json_serializable: '^6.1.5' + json_serializable: '6.9.3' {{/useJsonSerializable}} - test: ^1.16.0 + test: '^1.16.0'