From 8d1df966f390058d5af70a58296ef2ca23d1d4e1 Mon Sep 17 00:00:00 2001 From: Uladzimir_Paliukhovich Date: Tue, 1 Nov 2022 11:09:40 +0300 Subject: [PATCH] Version/2.8.3 (#480) * Fixed #469 * Fixed generation of list of enums instead of enums when needed Co-authored-by: Uladzimir Paliukhovich --- .../swagger_requests_generator.dart | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/src/code_generators/swagger_requests_generator.dart b/lib/src/code_generators/swagger_requests_generator.dart index 8cd0eb2c..97018f9b 100644 --- a/lib/src/code_generators/swagger_requests_generator.dart +++ b/lib/src/code_generators/swagger_requests_generator.dart @@ -329,7 +329,7 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase { .any((p0) => p0.code.toString().contains('symbol=Body'))) { return p.copyWith(type: Reference('dynamic')); } else { - return p.copyWith(type: Reference('List')); + return p.copyWith(type: Reference('List?')); } } } @@ -382,6 +382,13 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase { return '${p.name} : enums.\$${enumName}Map[${p.name}]$toStringPart'; } + + if (p.type!.symbol!.startsWith('List{}; definedParameters.addAll(root.parameters); @@ -663,7 +669,7 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase { if (schema?.ref.isNotEmpty == true) { schema = root.allSchemas[schema?.ref.getUnformattedRef()]; } - + schema?.properties.forEach((key, value) { if (value.type == 'string' && value.format == 'binary') { final isRequired = schema!.required.contains(key);