Repository: epam-cross-platform-lab/swagger-dart-code-generator (dart)

Issue:
[FEATURE] Support for deprecated annotations
Hi, it would be nice if we could parse any deprecated fields from our OpenAPI schema and add the deprecated class annotation in Dart:

https://api.flutter.dev/flutter/dart-core/Deprecated-class.html

It'd make it easier to spot deprecated changes through the IDE.

Pull request description:
Fix #699 
Fix #700

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e5f0678..0e954bcc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 * ***Breaking*** Added ability to rename downloaded swagger files ([#558](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/558))
 
+* Added support of deprecated fields and methods ([#699](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/699))
+
 # 2.13.5
 
 * Added `ErrorConverter` to create method
diff --git a/lib/src/code_generators/constants.dart b/lib/src/code_generators/constants.dart
index 6852a51e..473eea5b 100644
--- a/lib/src/code_generators/constants.dart
+++ b/lib/src/code_generators/constants.dart
@@ -60,6 +60,7 @@ const kFormData = 'formData';
 const kMultipart = 'multipart';
 const kDateTimeFormat = 'date-time';
 const kFactoryConverter = 'factoryConverter';
+const kDeprecatedAnnotation = '@deprecated';
 
 const kDefaultBodyParameter = 'Object';
 const kField = 'Field';
diff --git a/lib/src/code_generators/swagger_models_generator.dart b/lib/src/code_generators/swagger_models_generator.dart
index 6dce5ec8..25be4f2b 100644
--- a/lib/src/code_generators/swagger_models_generator.dart
+++ b/lib/src/code_generators/swagger_models_generator.dart
@@ -437,13 +437,14 @@ abstract class SwaggerModelsGenerator extends SwaggerGeneratorBase {
     return ', includeIfNull: ${options.includeIfNull}';
   }
 
-  String generatePropertyContentByDefault(
-    SwaggerSchema prop,
-    String propertyName,
-    List<String> allEnumNames,
-    List<String> allEnumListNames,
-    List<String> requiredProperties,
-  ) {
+  String generatePropertyContentByDefault({
+    required SwaggerSchema prop,
+    required String propertyName,
+    required List<String> allEnumNames,
+    required List<String> allEnumListNames,
+    required List<String> requiredProperties,
+    required bool isDeprecated,
+  }) {
     var typeName = '';
 
     if (prop.hasOriginalRef) {
@@ -487,8 +488,9 @@ abstract class SwaggerModelsGenerator extends SwaggerGeneratorBase {
 
     final jsonKeyContent =
         "@JsonKey(name: '$propertyKey'$includeIfNullString$dateToJsonValue${unknownEnumValue.jsonKey})\n";
+    final deprecatedContent = isDeprecated ? '@deprecated\n' : '';
 
-    return '\t$jsonKeyContent\tfinal $typeName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
+    return '\t$jsonKeyContent$deprecatedContent\tfinal $typeName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
   }
 
   JsonEnumValue generateEnumValue({
@@ -666,6 +668,8 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
 
     final jsonKeyContent =
         "@JsonKey(name: '${_validatePropertyKey(propertyKey)}'$includeIfNullString${unknownEnumValue.jsonKey}$dateToJsonValue)\n";
+    final deprecatedContent =
+        propertySchema.deprecated ? kDeprecatedAnnotation : '';
 
     if (prop.shouldBeNullable ||
         (options.nullableModels.contains(className) &&
@@ -673,7 +677,7 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
       typeName = typeName.makeNullable();
     }
 
-    return '\t$jsonKeyContent\tfinal $typeName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
+    return '\t$jsonKeyContent$deprecatedContent\tfinal $typeName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
   }
 
   String _validatePropertyKey(String key) {
@@ -734,13 +738,15 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
     final jsonKeyContent =
         "@JsonKey(name: '${_validatePropertyKey(propertyKey)}'$includeIfNullString${unknownEnumValue.jsonKey})\n";
 
+    final deprecatedContent = prop.deprecated ? kDeprecatedAnnotation : '';
+
     if (prop.shouldBeNullable ||
         options.nullableModels.contains(className) ||
         !requiredProperties.contains(propertyKey)) {
       typeName = typeName.makeNullable();
     }
 
-    return '\t$jsonKeyContent\tfinal $typeName $propertyName;${unknownEnumValue.fromJson}';
+    return '\t$jsonKeyContent$deprecatedContent\tfinal $typeName $propertyName;${unknownEnumValue.fromJson}';
   }
 
   String generatePropertyContentByRef(
@@ -806,6 +812,9 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
     final jsonKeyContent =
         "@JsonKey(name: '${_validatePropertyKey(propertyKey)}'$includeIfNullString${unknownEnumValue.jsonKey})\n";
 
+    final deprecatedContent =
+        refSchema?.deprecated == true ? kDeprecatedAnnotation : '';
+
     if (prop.shouldBeNullable ||
         options.nullableModels.contains(className) ||
         !requiredProperties.contains(propertyKey)) {
@@ -826,18 +835,19 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
       typeName += '?';
     }
 
-    return '\t$jsonKeyContent\tfinal $typeName $propertyName;${unknownEnumValue.fromJson}';
+    return '\t$jsonKeyContent$deprecatedContent\tfinal $typeName $propertyName;${unknownEnumValue.fromJson}';
   }
 
-  String generateEnumPropertyContent(
-    String key,
-    String className,
-    String propertyKey,
-    List<String> allEnumNames,
-    List<String> allEnumListNames,
-    SwaggerSchema prop,
-    List<String> requiredProperties,
-  ) {
+  String generateEnumPropertyContent({
+    required String key,
+    required String className,
+    required String propertyKey,
+    required List<String> allEnumNames,
+    required List<String> allEnumListNames,
+    required SwaggerSchema prop,
+    required List<String> requiredProperties,
+    required bool isDeprecated,
+  }) {
     final enumName = getValidatedClassName(generateEnumName(className, key));
 
     allEnumNames.add(enumName);
@@ -863,6 +873,7 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
 
     return '''
   @JsonKey(${unknownEnumValue.jsonKey.substring(2)}$includeIfNullString)
+  ${isDeprecated ? kDeprecatedAnnotation : ''}
   final $enumPropertyName ${generateFieldName(key)};
 
   ${unknownEnumValue.fromJson}''';
@@ -953,18 +964,19 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
     return typeName;
   }
 
-  String generateListPropertyContent(
-    String propertyName,
-    String propertyKey,
-    String className,
-    SwaggerSchema prop,
-    List<String> classesWithNullableLists,
-    List<String> allEnumNames,
-    List<String> allEnumListNames,
-    Map<String, String> basicTypesMap,
-    List<String> requiredProperties,
-    Map<String, SwaggerSchema> allClasses,
-  ) {
+  String generateListPropertyContent({
+    required String propertyName,
+    required String propertyKey,
+    required String className,
+    required SwaggerSchema prop,
+    required List<String> classesWithNullableLists,
+    required List<String> allEnumNames,
+    required List<String> allEnumListNames,
+    required Map<String, String> basicTypesMap,
+    required List<String> requiredProperties,
+    required Map<String, SwaggerSchema> allClasses,
+    required bool isDeprecated,
+  }) {
     final typeName = _generateListPropertyTypeName(
       allEnumListNames: allEnumListNames,
       allEnumNames: allEnumNames,
@@ -1004,6 +1016,8 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
           "@JsonKey(name: '$validatedPropertyKey'$includeIfNullString${unknownEnumValue.jsonKey})\n";
     }
 
+    final deprecatedContent = isDeprecated ? kDeprecatedAnnotation : '';
+
     var listPropertyName = 'List<$typeName>';
 
     if (prop.shouldBeNullable ||
@@ -1012,24 +1026,27 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
       listPropertyName = listPropertyName.makeNullable();
     }
 
-    return '$jsonKeyContent  final $listPropertyName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
+    return '$jsonKeyContent$deprecatedContent final $listPropertyName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
   }
 
-  String generateGeneralPropertyContent(
-    String propertyName,
-    String propertyKey,
-    String className,
-    List<DefaultValueMap> defaultValues,
-    SwaggerSchema prop,
-    List<String> allEnumNames,
-    List<String> allEnumListNames,
-    List<String> requiredProperties,
-  ) {
+  String generateGeneralPropertyContent({
+    required String propertyName,
+    required String propertyKey,
+    required String className,
+    required List<DefaultValueMap> defaultValues,
+    required SwaggerSchema prop,
+    required List<String> allEnumNames,
+    required List<String> allEnumListNames,
+    required List<String> requiredProperties,
+    required bool isDeprecated,
+  }) {
     final includeIfNullString = generateIncludeIfNullString();
 
     var jsonKeyContent =
         "@JsonKey(name: '${_validatePropertyKey(propertyKey)}'$includeIfNullString";
 
+    final isDeprecatedContent = isDeprecated ? kDeprecatedAnnotation : '';
+
     var typeName = '';
 
     if (prop.hasAdditionalProperties && prop.type == 'object') {
@@ -1085,7 +1102,7 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
       typeName = typeName.makeNullable();
     }
 
-    return '\t$jsonKeyContent  final $typeName $propertyName;${unknownEnumValue.fromJson}';
+    return '\t$jsonKeyContent$isDeprecatedContent  final $typeName $propertyName;${unknownEnumValue.fromJson}';
   }
 
   String generatePropertyContentByType(
@@ -1100,41 +1117,45 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
     Map<String, String> basicTypesMap,
     List<String> requiredProperties,
     Map<String, SwaggerSchema> allClasses,
+    bool isDeprecated,
   ) {
     switch (prop.type) {
       case 'array':
         return generateListPropertyContent(
-          propertyName,
-          propertyKey,
-          className,
-          prop,
-          classesWithNullableLists,
-          allEnumsNames,
-          allEnumListNames,
-          basicTypesMap,
-          requiredProperties,
-          allClasses,
+          propertyName: propertyName,
+          propertyKey: propertyKey,
+          className: className,
+          prop: prop,
+          classesWithNullableLists: classesWithNullableLists,
+          allEnumNames: allEnumsNames,
+          allEnumListNames: allEnumListNames,
+          basicTypesMap: basicTypesMap,
+          requiredProperties: requiredProperties,
+          allClasses: allClasses,
+          isDeprecated: isDeprecated,
         );
       case 'enum':
         return generateEnumPropertyContent(
-          propertyName,
-          className,
-          propertyKey,
-          allEnumsNames,
-          allEnumListNames,
-          prop,
-          requiredProperties,
+          key: propertyName,
+          className: className,
+          propertyKey: propertyKey,
+          allEnumNames: allEnumsNames,
+          allEnumListNames: allEnumListNames,
+          prop: prop,
+          requiredProperties: requiredProperties,
+          isDeprecated: isDeprecated,
         );
       default:
         return generateGeneralPropertyContent(
-          propertyName,
-          propertyKey,
-          className,
-          defaultValues,
-          prop,
-          allEnumsNames,
-          allEnumListNames,
-          requiredProperties,
+          propertyName: propertyName,
+          propertyKey: propertyKey,
+          className: className,
+          defaultValues: defaultValues,
+          prop: prop,
+          allEnumNames: allEnumsNames,
+          allEnumListNames: allEnumListNames,
+          requiredProperties: requiredProperties,
+          isDeprecated: isDeprecated,
         );
     }
   }
@@ -1198,6 +1219,7 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
           basicTypesMap,
           requiredProperties,
           allClasses,
+          prop.deprecated,
         ));
       } else if (prop.allOf.isNotEmpty) {
         results.add(
@@ -1237,11 +1259,12 @@ static $returnType $fromJsonFunction($valueType? value) => $enumNameCamelCase$fr
         ));
       } else {
         results.add(generatePropertyContentByDefault(
-          prop,
-          propertyName,
-          allEnumNames,
-          allEnumListNames,
-          requiredProperties,
+          prop: prop,
+          propertyName: propertyName,
+          allEnumNames: allEnumNames,
+          allEnumListNames: allEnumListNames,
+          requiredProperties: requiredProperties,
+          isDeprecated: prop.deprecated,
         ));
       }
     }
diff --git a/lib/src/code_generators/swagger_requests_generator.dart b/lib/src/code_generators/swagger_requests_generator.dart
index a9637d5d..10101d58 100644
--- a/lib/src/code_generators/swagger_requests_generator.dart
+++ b/lib/src/code_generators/swagger_requests_generator.dart
@@ -216,8 +216,14 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
             componentsParameters: swaggerRoot.components?.parameters ?? {},
           ))
           ..name = methodName
-          ..annotations.addAll(_getMethodAnnotation(requestType, annotationPath,
-              hasOptionalBody, isMultipart, isUrlencoded))
+          ..annotations.addAll(_getMethodAnnotation(
+            requestType: requestType,
+            path: annotationPath,
+            hasOptionalBody: hasOptionalBody,
+            isMultipart: isMultipart,
+            isUrlencoded: isUrlencoded,
+            isDeprecated: swaggerRequest.deprecated,
+          ))
           ..returns = Reference(returns));
 
         final allModels = _getAllMethodModels(
@@ -227,7 +233,11 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
         );
 
         final privateMethod = _getPrivateMethod(method);
-        final publicMethod = _getPublicMethod(method, allModels);
+        final publicMethod = _getPublicMethod(
+          method,
+          allModels,
+          swaggerRequest.deprecated,
+        );
         methods.addAll([publicMethod, privateMethod]);
       });
     });
@@ -352,6 +362,9 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
     } else if (successResponse?.content?.schema?.properties.isNotEmpty ==
         true) {
       results.add(response);
+    } else if (successResponse?.content?.schema?.allOf.isNotEmpty == true &&
+        successResponse?.content?.schema?.title.isNotEmpty == true) {
+      results.add(response);
     }
 
     return results.where((element) => _isValidModelName(element)).toList();
@@ -412,7 +425,8 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
     );
   }
 
-  Method _getPublicMethod(Method method, List<String> allModels) {
+  Method _getPublicMethod(
+      Method method, List<String> allModels, bool isDeprecated) {
     final parameters =
         method.optionalParameters.map((p) => p.copyWith(annotations: []));
 
@@ -422,6 +436,7 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
         ..docs.addAll(method.docs)
         ..name = method.name
         ..returns = method.returns
+        ..annotations.addAll([if (isDeprecated) refer('deprecated')])
         ..body = _generatePublicMethodCode(
           method.optionalParameters,
           method.name!,
@@ -472,9 +487,16 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
         '$allModelsString\nreturn _$publicMethodName($parametersListString);');
   }
 
-  List<Expression> _getMethodAnnotation(String requestType, String path,
-      bool hasOptionalBody, bool isMultipart, bool isUrlencoded) {
+  List<Expression> _getMethodAnnotation({
+    required String requestType,
+    required String path,
+    required bool hasOptionalBody,
+    required bool isMultipart,
+    required bool isUrlencoded,
+    required bool isDeprecated,
+  }) {
     return [
+      if (isDeprecated) refer('deprecated'),
       refer(requestType.pascalCase).call(
         [],
         {
diff --git a/lib/src/swagger_models/requests/swagger_request.dart b/lib/src/swagger_models/requests/swagger_request.dart
index df8a66a4..259c7967 100644
--- a/lib/src/swagger_models/requests/swagger_request.dart
+++ b/lib/src/swagger_models/requests/swagger_request.dart
@@ -18,6 +18,7 @@ class SwaggerRequest {
     this.produces = const [],
     this.security = const [],
     this.requestBody,
+    this.deprecated = false,
   });
 
   @JsonKey(name: 'summary', defaultValue: '')
@@ -26,6 +27,9 @@ class SwaggerRequest {
   @JsonKey(name: 'description', defaultValue: '')
   String description;
 
+  @JsonKey(name: 'deprecated', defaultValue: false)
+  bool deprecated;
+
   @JsonKey(name: 'operationId', defaultValue: '')
   String operationId;
 
diff --git a/lib/src/swagger_models/requests/swagger_request.g2.dart b/lib/src/swagger_models/requests/swagger_request.g2.dart
index 22955754..83fff390 100644
--- a/lib/src/swagger_models/requests/swagger_request.g2.dart
+++ b/lib/src/swagger_models/requests/swagger_request.g2.dart
@@ -11,6 +11,7 @@ SwaggerRequest _$SwaggerRequestFromJson(Map<String, dynamic> json) =>
       summary: json['summary'] as String? ?? '',
       description: json['description'] as String? ?? '',
       operationId: json['operationId'] as String? ?? '',
+      deprecated: json['deprecated'] as bool? ?? false,
       consumes: (json['consumes'] as List<dynamic>?)
               ?.map((e) => e as String)
               .toList() ??
@@ -42,6 +43,7 @@ Map<String, dynamic> _$SwaggerRequestToJson(SwaggerRequest instance) =>
       'summary': instance.summary,
       'description': instance.description,
       'operationId': instance.operationId,
+      'deprecated': instance.deprecated,
       'consumes': instance.consumes,
       'produces': instance.produces,
       'responses': instance.responses,
diff --git a/lib/src/swagger_models/responses/swagger_schema.dart b/lib/src/swagger_models/responses/swagger_schema.dart
index 5f91fb72..09ecb64c 100644
--- a/lib/src/swagger_models/responses/swagger_schema.dart
+++ b/lib/src/swagger_models/responses/swagger_schema.dart
@@ -27,6 +27,7 @@ class SwaggerSchema {
     this.title = '',
     this.readOnly = false,
     this.writeOnly = false,
+    this.deprecated = false,
   });
 
   @JsonKey(name: 'readOnly', defaultValue: false)
@@ -38,6 +39,9 @@ class SwaggerSchema {
   @JsonKey(name: 'type', defaultValue: '')
   String type;
 
+  @JsonKey(name: 'deprecated', defaultValue: false)
+  bool deprecated;
+
   @JsonKey(name: 'title', defaultValue: '')
   String title;
 
diff --git a/lib/src/swagger_models/responses/swagger_schema.g2.dart b/lib/src/swagger_models/responses/swagger_schema.g2.dart
index deb0075f..2d9c735b 100644
--- a/lib/src/swagger_models/responses/swagger_schema.g2.dart
+++ b/lib/src/swagger_models/responses/swagger_schema.g2.dart
@@ -44,6 +44,7 @@ SwaggerSchema _$SwaggerSchemaFromJson(Map<String, dynamic> json) =>
       title: json['title'] as String? ?? '',
       readOnly: json['readOnly'] as bool? ?? false,
       writeOnly: json['writeOnly'] as bool? ?? false,
+      deprecated: json['deprecated'] as bool? ?? false,
       enumNames: (json['enumNames'] as List<dynamic>?)
           ?.map((e) => e as String)
           .toList(),
@@ -77,6 +78,7 @@ Map<String, dynamic> _$SwaggerSchemaToJson(SwaggerSchema instance) =>
       'title': instance.title,
       'readOnly': instance.readOnly,
       'writeOnly': instance.writeOnly,
+      'deprecated': instance.deprecated,
       'additionalProperties': instance.hasAdditionalProperties,
       'enumNames': instance.enumNames,
     };
diff --git a/pubspec.yaml b/pubspec.yaml
index 3063e3ac..a6d39907 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
 name: swagger_dart_code_generator
 
-version: 2.13.5
+version: 2.14.1
 
 homepage: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator
 repository: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator


Test patch:
diff --git a/test/generator_tests/models_generator_test.dart b/test/generator_tests/models_generator_test.dart
index c93d4190..7663d7c6 100644
--- a/test/generator_tests/models_generator_test.dart
+++ b/test/generator_tests/models_generator_test.dart
@@ -161,11 +161,12 @@ void main() {
       const propertyName = 'shipDate';
       const jsonKeyExpendedResult = "@JsonKey(name: '$propertyName'";
       final result = generator.generatePropertyContentByDefault(
-        propertyEntryMap,
-        propertyName,
-        [],
-        [],
-        [],
+        prop: propertyEntryMap,
+        propertyName: propertyName,
+        allEnumNames: [],
+        allEnumListNames: [],
+        requiredProperties: [],
+        isDeprecated: false,
       );
 
       expect(result, contains(jsonKeyExpendedResult));
@@ -179,11 +180,12 @@ void main() {
         outputFolder: '',
         includeIfNull: false,
       )).generatePropertyContentByDefault(
-        propertyEntryMap,
-        propertyName,
-        [],
-        [],
-        [],
+        prop: propertyEntryMap,
+        propertyName: propertyName,
+        allEnumNames: [],
+        allEnumListNames: [],
+        requiredProperties: [],
+        isDeprecated: false,
       );
 
       expect(result, contains(', includeIfNull: false'));
@@ -193,11 +195,12 @@ void main() {
       final propertyEntryMap = SwaggerSchema(originalRef: 'Pet');
       const propertyName = 'shipDate';
       final result = generator.generatePropertyContentByDefault(
-        propertyEntryMap,
-        propertyName,
-        [],
-        [],
-        [],
+        prop: propertyEntryMap,
+        propertyName: propertyName,
+        allEnumNames: [],
+        allEnumListNames: [],
+        requiredProperties: [],
+        isDeprecated: false,
       );
 
       expect(result.contains(', includeIfNull: false'), equals(false));
@@ -422,16 +425,17 @@ void main() {
 
       const propertyExpectedResult = 'final List<Object>? dog';
       final result = generator.generateListPropertyContent(
-        propertyName,
-        propertyKey,
-        className,
-        map,
-        [],
-        [],
-        [],
-        {},
-        [],
-        {},
+        propertyName: propertyName,
+        propertyKey: propertyKey,
+        className: className,
+        prop: map,
+        classesWithNullableLists: [],
+        allEnumNames: [],
+        allEnumListNames: [],
+        basicTypesMap: {},
+        requiredProperties: [],
+        allClasses: {},
+        isDeprecated: false,
       );
 
       expect(result, contains(jsonKeyExpectedResult));
@@ -444,16 +448,17 @@ void main() {
       const className = 'Animals';
       const propertyKey = 'Dog';
       final result = generator.generateListPropertyContent(
-        propertyName,
-        propertyKey,
-        className,
-        map,
-        [],
-        ['Dog'],
-        [],
-        {},
-        [],
-        {},
+        propertyName: propertyName,
+        propertyKey: propertyKey,
+        className: className,
+        prop: map,
+        classesWithNullableLists: [],
+        allEnumNames: ['Dog'],
+        allEnumListNames: [],
+        basicTypesMap: {},
+        requiredProperties: [],
+        allClasses: {},
+        isDeprecated: false,
       );
 
       expect(
@@ -468,16 +473,17 @@ void main() {
       const propertyKey = 'Dog';
 
       final result = generator.generateListPropertyContent(
-        propertyName,
-        propertyKey,
-        className,
-        map,
-        [],
-        [],
-        [],
-        {},
-        [],
-        {},
+        propertyName: propertyName,
+        propertyKey: propertyKey,
+        className: className,
+        prop: map,
+        classesWithNullableLists: [],
+        allEnumNames: [],
+        allEnumListNames: [],
+        basicTypesMap: {},
+        requiredProperties: [],
+        allClasses: {},
+        isDeprecated: false,
       );
 
       expect(result, contains('final List<TestOriginalRef>? dog;'));
@@ -491,16 +497,17 @@ void main() {
       const propertyKey = 'Dog';
 
       final result = generator.generateListPropertyContent(
-        propertyName,
-        propertyKey,
-        className,
-        map,
-        [],
-        [],
-        [],
-        {},
-        [],
-        {},
+        propertyName: propertyName,
+        propertyKey: propertyKey,
+        className: className,
+        prop: map,
+        classesWithNullableLists: [],
+        allEnumNames: [],
+        allEnumListNames: [],
+        basicTypesMap: {},
+        requiredProperties: [],
+        allClasses: {},
+        isDeprecated: false,
       );
 
       expect(result, contains('final List<TestObject>? dog;'));