diff --git a/CHANGELOG.md b/CHANGELOG.md index b38e9375..52be55fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.8.8 + +* Fixed generation of some List models + # 2.8.7 * Fixed generation `allOf` properties with just properties ([#507](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/507)) diff --git a/lib/src/code_generators/swagger_requests_generator.dart b/lib/src/code_generators/swagger_requests_generator.dart index d8461693..a7f9cf50 100644 --- a/lib/src/code_generators/swagger_requests_generator.dart +++ b/lib/src/code_generators/swagger_requests_generator.dart @@ -254,11 +254,11 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase { final itemType = getValidatedClassName(ref.getUnformattedRef()); results.add(itemType); } else { - final itemsType = schema?.items?.type; + final itemsType = schema?.items?.type ?? ''; - if (!kBasicTypes.contains(itemsType) && - schema?.items?.properties != null) { - final itemClassName = '$response\$Item'; + if (!kBasicTypes.contains(itemsType) && itemsType != 'object' && + schema?.items?.properties != null && !itemsType.startsWith('List<')) { + final itemClassName = '$itemsType\$Item'; results.add(itemClassName); } diff --git a/pubspec.yaml b/pubspec.yaml index e6a6f125..cd716b1c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: swagger_dart_code_generator -version: 2.8.7 +version: 2.8.8 homepage: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator repository: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator