diff --git a/swagger_parser/CHANGELOG.md b/swagger_parser/CHANGELOG.md index 4929d5c8..adb751a8 100644 --- a/swagger_parser/CHANGELOG.md +++ b/swagger_parser/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.10.2 +- Fix error in `body` with name in dart template + ## 1.10.1 - Fix error with query parameter named `body` ([#108](https://github.com/Carapacik/swagger_parser/issues/108)) diff --git a/swagger_parser/example/pubspec.yaml b/swagger_parser/example/pubspec.yaml index 9c7e843e..210f80a8 100644 --- a/swagger_parser/example/pubspec.yaml +++ b/swagger_parser/example/pubspec.yaml @@ -8,14 +8,14 @@ dependencies: dio: ^5.3.3 freezed_annotation: ^2.4.1 json_annotation: ^4.8.1 - retrofit: ^4.0.2 + retrofit: ^4.0.3 dev_dependencies: build_runner: ^2.4.6 carapacik_lints: ^1.4.2 - freezed: ^2.4.3 + freezed: ^2.4.5 json_serializable: ^6.7.1 - retrofit_generator: ^8.0.0 + retrofit_generator: ^8.0.1 swagger_parser: path: ../ diff --git a/swagger_parser/lib/src/generator/templates/dart_retrofit_client_template.dart b/swagger_parser/lib/src/generator/templates/dart_retrofit_client_template.dart index aa096dec..3917839a 100644 --- a/swagger_parser/lib/src/generator/templates/dart_retrofit_client_template.dart +++ b/swagger_parser/lib/src/generator/templates/dart_retrofit_client_template.dart @@ -68,7 +68,7 @@ String _fileImport(UniversalRestClient restClient) => restClient.requests.any( : ''; String _toParameter(UniversalRequestType parameter) => - " @${parameter.parameterType.type}(${parameter.name != null ? "${parameter.parameterType.isPart ? 'name: ' : ''}'${parameter.name}'" : ''}) " + " @${parameter.parameterType.type}(${parameter.name != null && !parameter.parameterType.isBody ? "${parameter.parameterType.isPart ? 'name: ' : ''}'${parameter.name}'" : ''}) " '${_required(parameter.type)}' '${parameter.type.toSuitableType(ProgrammingLanguage.dart)} ' '${parameter.type.name!.toCamel}${_defaultValue(parameter.type)},'; diff --git a/swagger_parser/lib/src/generator/templates/kotlin_retrofit_client_template.dart b/swagger_parser/lib/src/generator/templates/kotlin_retrofit_client_template.dart index 549dbaff..bd4b1ead 100644 --- a/swagger_parser/lib/src/generator/templates/kotlin_retrofit_client_template.dart +++ b/swagger_parser/lib/src/generator/templates/kotlin_retrofit_client_template.dart @@ -60,7 +60,7 @@ String _toClientRequest(UniversalRequest request) { } String _toQueryParameter(UniversalRequestType parameter) => - ' @${parameter.parameterType.type}${parameter.parameterType.isBody ? '' : '("${parameter.name}")'} ' + ' @${parameter.parameterType.type}${parameter.name != null && !parameter.parameterType.isBody ? '("${parameter.name}")' : ''} ' '${parameter.type.name!.toCamel}: ${parameter.type.toSuitableType(ProgrammingLanguage.kotlin)}' '${_defaultValue(parameter.type)}'; diff --git a/swagger_parser/pubspec.yaml b/swagger_parser/pubspec.yaml index d3e22a0b..19e3839d 100644 --- a/swagger_parser/pubspec.yaml +++ b/swagger_parser/pubspec.yaml @@ -1,6 +1,6 @@ name: swagger_parser description: Package that generates REST clients and data classes from OpenApi definition file -version: 1.10.1 +version: 1.10.2 repository: https://github.com/Carapacik/swagger_parser/tree/main/swagger_parser homepage: https://omega-r.com topics: