diff --git a/CHANGELOG.md b/CHANGELOG.md index 1713b8e4..9e71293f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ * Fixed generation of request bodies in some cases ([#489](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/489)) +* Added `Method` to key classes ([#492](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/492)) + +* Fixed generation of list request bodies ([#493](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/493)) + # 2.8.5 * Fixed generation of request bodies with refs ([#484](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/484)) diff --git a/lib/src/code_generators/constants.dart b/lib/src/code_generators/constants.dart index ab9bd37c..75b72034 100644 --- a/lib/src/code_generators/constants.dart +++ b/lib/src/code_generators/constants.dart @@ -9,6 +9,7 @@ const List kKeyClasses = [ 'Type', 'Query', 'Body', + 'Method', ]; const kBasicTypes = [ diff --git a/lib/src/code_generators/swagger_requests_generator.dart b/lib/src/code_generators/swagger_requests_generator.dart index 3aa4ddf1..f9d4d2c5 100644 --- a/lib/src/code_generators/swagger_requests_generator.dart +++ b/lib/src/code_generators/swagger_requests_generator.dart @@ -738,6 +738,9 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase { if (schema != null) { if (schema.format == kBinary) { typeName = kObject.pascalCase; + } else if (schema.items?.type.isNotEmpty == true) { + typeName = _mapParameterName( + schema.items!.type, schema.items!.format, options.modelPostfix).asList(); } else { typeName = _getRequestBodyTypeName( schema: schema, diff --git a/lib/swagger_dart_code_generator.dart b/lib/swagger_dart_code_generator.dart index a5304dfa..50ea676c 100644 --- a/lib/swagger_dart_code_generator.dart +++ b/lib/swagger_dart_code_generator.dart @@ -212,7 +212,7 @@ class SwaggerDartCodeGenerator implements Builder { final imports = codeGenerator.generateImportsContent( fileNameWithoutExtension, - models.isNotEmpty || requestBodies.isNotEmpty, + models.isNotEmpty || requestBodies.isNotEmpty || responses.isNotEmpty, options.buildOnlyModels, enums.isNotEmpty, options.separateModels,