|
|
@ -190,14 +190,10 @@ Iterable<Method> buildTags( |
|
|
|
]..sort(sortRequiredParameters); |
|
|
|
]..sort(sortRequiredParameters); |
|
|
|
final name = toDartName(filterMethodName(operationName, tag ?? '')); |
|
|
|
final name = toDartName(filterMethodName(operationName, tag ?? '')); |
|
|
|
|
|
|
|
|
|
|
|
var responses = <openapi.Response, List<int>>{}; |
|
|
|
var responses = <openapi.Response, List<String>>{}; |
|
|
|
if (operation.responses != null) { |
|
|
|
if (operation.responses != null) { |
|
|
|
for (final responseEntry in operation.responses!.entries) { |
|
|
|
for (final responseEntry in operation.responses!.entries) { |
|
|
|
final statusCode = int.tryParse(responseEntry.key); |
|
|
|
final statusCode = responseEntry.key; |
|
|
|
if (statusCode == null) { |
|
|
|
|
|
|
|
print('Default responses are not supported right now. Skipping it for $operationName'); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
final response = responseEntry.value; |
|
|
|
final response = responseEntry.value; |
|
|
|
|
|
|
|
|
|
|
|
responses[response] ??= []; |
|
|
|
responses[response] ??= []; |
|
|
@ -225,7 +221,6 @@ Iterable<Method> buildTags( |
|
|
|
'''); |
|
|
|
'''); |
|
|
|
|
|
|
|
|
|
|
|
buildAuthCheck( |
|
|
|
buildAuthCheck( |
|
|
|
responses, |
|
|
|
|
|
|
|
pathEntry, |
|
|
|
pathEntry, |
|
|
|
operation, |
|
|
|
operation, |
|
|
|
spec, |
|
|
|
spec, |
|
|
@ -357,9 +352,13 @@ final _uri = Uri(path: _path, queryParameters: _queryParameters.isNotEmpty ? _qu |
|
|
|
'''); |
|
|
|
'''); |
|
|
|
|
|
|
|
|
|
|
|
if (responses.values.isNotEmpty) { |
|
|
|
if (responses.values.isNotEmpty) { |
|
|
|
|
|
|
|
if (statusCodes.contains('default')) { |
|
|
|
|
|
|
|
code.writeln('null,'); |
|
|
|
|
|
|
|
} else { |
|
|
|
final codes = statusCodes.join(','); |
|
|
|
final codes = statusCodes.join(','); |
|
|
|
code.writeln('const {$codes},'); |
|
|
|
code.writeln('const {$codes},'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
code.writeln(''' |
|
|
|
code.writeln(''' |
|
|
|
), |
|
|
|
), |
|
|
@ -478,7 +477,6 @@ Iterable<String> buildPatternCheck( |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Iterable<String> buildAuthCheck( |
|
|
|
Iterable<String> buildAuthCheck( |
|
|
|
final Map<openapi.Response, List<int>> responses, |
|
|
|
|
|
|
|
final MapEntry<String, openapi.PathItem> pathEntry, |
|
|
|
final MapEntry<String, openapi.PathItem> pathEntry, |
|
|
|
final openapi.Operation operation, |
|
|
|
final openapi.Operation operation, |
|
|
|
final openapi.OpenAPI spec, |
|
|
|
final openapi.OpenAPI spec, |
|
|
|