forked from loafle/openapi-generator-original
dart codegen improvements (#3440)
* fix: query params may be ints as well don't assume query params are Strings or List<String>s * fix dart: use correct type for QueryParams type is Iterable, not List only check params for != null if they haven't been checked already add some casts to make strong mode happy update petstore * feat dart: enable strong mode * feat dart: generate both browser and vm library move petstore client into subdirectory and reference generated libraries using path in pubspec.yaml * feat dart: refactor petstore test. The new layout resembles a real project. petstore test is now strong mode compatible. * feat: add DateTimerParser transformer * feat: improved exception reporting * feat[dart]: handle patch requests * fix[dart]: typo * fix dart: remove findPetsByTag test; enable strong-mode find pets by tag call is deprecated and returns 500 generated library is now strong mode compatible
This commit is contained in:
committed by
wing328
parent
a1e7c517d3
commit
bf17a91275
@@ -3,19 +3,19 @@ part of {{pubName}}.api;
|
||||
const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'};
|
||||
|
||||
// port from Java version
|
||||
List<QueryParam> _convertParametersForCollectionFormat(
|
||||
Iterable<QueryParam> _convertParametersForCollectionFormat(
|
||||
String collectionFormat, String name, dynamic value) {
|
||||
var params = [];
|
||||
var params = <QueryParam>[];
|
||||
|
||||
// preconditions
|
||||
if (name == null || name.isEmpty || value == null) return params;
|
||||
|
||||
if (value is! List) {
|
||||
params.add(new QueryParam(name, value as String));
|
||||
params.add(new QueryParam(name, '$value'));
|
||||
return params;
|
||||
}
|
||||
|
||||
List<String> values = value as List<String>;
|
||||
List values = value as List;
|
||||
|
||||
// get the collection format
|
||||
collectionFormat = (collectionFormat == null || collectionFormat.isEmpty)
|
||||
@@ -23,7 +23,7 @@ List<QueryParam> _convertParametersForCollectionFormat(
|
||||
: collectionFormat; // default: csv
|
||||
|
||||
if (collectionFormat == "multi") {
|
||||
return values.map((v) => new QueryParam(name, v));
|
||||
return values.map((v) => new QueryParam(name, '$v'));
|
||||
}
|
||||
|
||||
String delimiter = _delimiters[collectionFormat] ?? ",";
|
||||
|
||||
Reference in New Issue
Block a user