Skip to content

Commit

Permalink
Fixed #415
Browse files Browse the repository at this point in the history
  • Loading branch information
uladzimir_paliukhovich committed Jun 2, 2022
1 parent fdc049c commit e6ef2a6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/src/code_generators/swagger_requests_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,6 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {

if (parameter.inParameter == kHeader) {
return _mapParameterName(kString, format, '');
} else if (parameter.inParameter == kPath) {
return _mapParameterName(kString, format, '');
} else if (parameter.items?.enumValues.isNotEmpty == true ||
parameter.schema?.enumValues.isNotEmpty == true) {
return _getEnumParameterTypeName(
Expand Down Expand Up @@ -554,11 +552,15 @@ class SwaggerRequestsGenerator extends SwaggerGeneratorBase {
return _mapParameterName(parameter.schema!.anyOf.first.type, format, '');
}

var neededType = parameter.type.isNotEmpty
? parameter.type
: parameter.schema?.type ?? kObject.pascalCase;
if (parameter.type.isNotEmpty) {
return _mapParameterName(parameter.type, format, modelPostfix);
}

if (parameter.schema?.type.isNotEmpty == true) {
return _mapParameterName(parameter.schema!.type, format, modelPostfix);
}

return _mapParameterName(neededType, format, modelPostfix);
return kObject.pascalCase;
}

String _mapParameterName(String name, String format, String modelPostfix) {
Expand Down

0 comments on commit e6ef2a6

Please sign in to comment.