forked from loafle/openapi-generator-original
[dart][dart-dio] Prevent name clashes with existing dart types (#8198)
* [dart][dart-dio] Prevent name clashes with existing dart types Can not use dart import aliases for now as this is not supported by built_value. This means we need to add potentially clashing names/classes to an `additionalReservedWords` exclusion list. Starting with a basic list of some http/io classes. Correctly use `importMapping` and `defaultIncludes` this time around. Improve reserved word checking. This now successfully generates `ModelList`, `ModelFile` and `ModelClient` models which previously were not generated at all or were wrong types. * Address review comment * Update generator docs
This commit is contained in:
parent
80df0b0004
commit
e1c43f1356
@ -33,19 +33,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|BuiltList|package:built_collection/built_collection.dart|
|
||||
|BuiltMap|package:built_collection/built_collection.dart|
|
||||
|BuiltSet|package:built_collection/built_collection.dart|
|
||||
|DateTime|dart:core|
|
||||
|JsonObject|package:built_value/json_object.dart|
|
||||
|List|dart:core|
|
||||
|Map|dart:core|
|
||||
|Object|dart:core|
|
||||
|Set|dart:core|
|
||||
|String|dart:core|
|
||||
|Uint8List|dart:typed_data|
|
||||
|bool|dart:core|
|
||||
|double|dart:core|
|
||||
|dynamic|dart:core|
|
||||
|int|dart:core|
|
||||
|num|dart:core|
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
@ -62,6 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>String</li>
|
||||
<li>bool</li>
|
||||
<li>double</li>
|
||||
<li>dynamic</li>
|
||||
<li>int</li>
|
||||
<li>num</li>
|
||||
</ul>
|
||||
|
@ -30,17 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|DateTime|dart:core|
|
||||
|List|dart:core|
|
||||
|Map|dart:core|
|
||||
|Object|dart:core|
|
||||
|Set|dart:core|
|
||||
|String|dart:core|
|
||||
|bool|dart:core|
|
||||
|double|dart:core|
|
||||
|dynamic|dart:core|
|
||||
|int|dart:core|
|
||||
|num|dart:core|
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
@ -57,6 +46,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>String</li>
|
||||
<li>bool</li>
|
||||
<li>double</li>
|
||||
<li>dynamic</li>
|
||||
<li>int</li>
|
||||
<li>num</li>
|
||||
</ul>
|
||||
|
@ -28,17 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Type/Alias | Imports |
|
||||
| ---------- | ------- |
|
||||
|DateTime|dart:core|
|
||||
|List|dart:core|
|
||||
|Map|dart:core|
|
||||
|Object|dart:core|
|
||||
|Set|dart:core|
|
||||
|String|dart:core|
|
||||
|bool|dart:core|
|
||||
|double|dart:core|
|
||||
|dynamic|dart:core|
|
||||
|int|dart:core|
|
||||
|num|dart:core|
|
||||
|
||||
|
||||
## INSTANTIATION TYPES
|
||||
@ -55,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
<li>String</li>
|
||||
<li>bool</li>
|
||||
<li>double</li>
|
||||
<li>dynamic</li>
|
||||
<li>int</li>
|
||||
<li>num</li>
|
||||
</ul>
|
||||
|
@ -73,6 +73,10 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
protected String apiTestPath = "test" + File.separator;
|
||||
protected String modelTestPath = "test" + File.separator;
|
||||
|
||||
// Names that must not be used as model names because they clash with existing
|
||||
// default imports (dart:io, dart:async, package:http etc.) but are not basic dataTypes.
|
||||
protected Set<String> additionalReservedWords;
|
||||
|
||||
public DartClientCodegen() {
|
||||
super();
|
||||
|
||||
@ -131,7 +135,8 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
"bool",
|
||||
"int",
|
||||
"num",
|
||||
"double"
|
||||
"double",
|
||||
"dynamic"
|
||||
);
|
||||
instantiationTypes.put("array", "List");
|
||||
instantiationTypes.put("map", "Map");
|
||||
@ -155,7 +160,7 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
typeMapping.put("Date", "DateTime");
|
||||
typeMapping.put("date", "DateTime");
|
||||
typeMapping.put("DateTime", "DateTime");
|
||||
typeMapping.put("File", "MultipartFile");
|
||||
typeMapping.put("file", "MultipartFile");
|
||||
typeMapping.put("binary", "MultipartFile");
|
||||
typeMapping.put("UUID", "String");
|
||||
typeMapping.put("URI", "String");
|
||||
@ -163,21 +168,29 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("AnyType", "Object");
|
||||
|
||||
// These are needed as they prevent models from being generated
|
||||
// which would clash with existing types, e.g. List
|
||||
importMapping.put("dynamic", "dart:core");
|
||||
importMapping.put("Object", "dart:core");
|
||||
importMapping.put("String", "dart:core");
|
||||
importMapping.put("bool", "dart:core");
|
||||
importMapping.put("num", "dart:core");
|
||||
importMapping.put("int", "dart:core");
|
||||
importMapping.put("double", "dart:core");
|
||||
importMapping.put("List", "dart:core");
|
||||
importMapping.put("Map", "dart:core");
|
||||
importMapping.put("Set", "dart:core");
|
||||
importMapping.put("DateTime", "dart:core");
|
||||
// DataTypes of the above values which are automatically imported.
|
||||
// They are also not allowed to be model names.
|
||||
defaultIncludes = Sets.newHashSet(
|
||||
"String",
|
||||
"bool",
|
||||
"int",
|
||||
"num",
|
||||
"double",
|
||||
"dynamic",
|
||||
"List",
|
||||
"Set",
|
||||
"Map",
|
||||
"DateTime",
|
||||
"Object",
|
||||
"MultipartFile"
|
||||
);
|
||||
|
||||
defaultIncludes = new HashSet<>(Collections.singletonList("dart:core"));
|
||||
additionalReservedWords = Sets.newHashSet(
|
||||
"File",
|
||||
"Client",
|
||||
"Future",
|
||||
"Response"
|
||||
);
|
||||
|
||||
cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code"));
|
||||
cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec"));
|
||||
@ -306,6 +319,15 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
// consider everything as reserved that is either a keyword,
|
||||
// a default included type, or a type include through some library
|
||||
return super.isReservedWord(word) ||
|
||||
defaultIncludes().contains(word) ||
|
||||
additionalReservedWords.contains(word);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
return name + "_";
|
||||
@ -370,7 +392,7 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
name = "n" + name;
|
||||
}
|
||||
|
||||
if (isReservedWord(name) || importMapping().containsKey(name)) {
|
||||
if (isReservedWord(name)) {
|
||||
name = escapeReservedWord(name);
|
||||
}
|
||||
|
||||
@ -385,10 +407,6 @@ public class DartClientCodegen extends DefaultCodegen {
|
||||
|
||||
@Override
|
||||
public String toModelName(final String name) {
|
||||
if (importMapping().containsKey(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
String nameWithPrefixSuffix = sanitizeName(name);
|
||||
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||
// add '_' so that model name can be camelized correctly
|
||||
|
@ -19,14 +19,9 @@ package org.openapitools.codegen.languages;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CliOption;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.CodegenModel;
|
||||
import org.openapitools.codegen.CodegenOperation;
|
||||
import org.openapitools.codegen.CodegenParameter;
|
||||
import org.openapitools.codegen.CodegenProperty;
|
||||
import org.openapitools.codegen.SupportingFile;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.ProcessUtils;
|
||||
import org.slf4j.Logger;
|
||||
@ -35,8 +30,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class DartDioClientCodegen extends DartClientCodegen {
|
||||
@ -49,7 +42,6 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
|
||||
private boolean nullableFields = true;
|
||||
private String dateLibrary = "core";
|
||||
private static final Set<String> reservedBuiltValueWords = Sets.newHashSet("EnumClass");
|
||||
|
||||
public DartDioClientCodegen() {
|
||||
super();
|
||||
@ -75,6 +67,17 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
typeMapping.put("object", "JsonObject");
|
||||
typeMapping.put("AnyType", "JsonObject");
|
||||
|
||||
additionalReservedWords.addAll(Sets.newHashSet(
|
||||
"EnumClass",
|
||||
// The following are reserved dataTypes but can not be added to defaultIncludes
|
||||
// as this would prevent them from being added to the imports.
|
||||
"BuiltList",
|
||||
"BuiltSet",
|
||||
"BuiltMap",
|
||||
"Uint8List",
|
||||
"JsonObject"
|
||||
));
|
||||
|
||||
importMapping.put("BuiltList", "package:built_collection/built_collection.dart");
|
||||
importMapping.put("BuiltSet", "package:built_collection/built_collection.dart");
|
||||
importMapping.put("BuiltMap", "package:built_collection/built_collection.dart");
|
||||
@ -108,11 +111,6 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
return "Generates a Dart Dio client library.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isReservedWord(String word) {
|
||||
return super.isReservedWord(word) || reservedBuiltValueWords.contains(word);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
|
||||
return super.addMustacheLambdas()
|
||||
@ -227,19 +225,18 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart"));
|
||||
|
||||
if ("core".equals(dateLibrary)) {
|
||||
// this option uses the same classes as normal dart generator
|
||||
additionalProperties.put("core", "true");
|
||||
typeMapping.put("Date", "DateTime");
|
||||
typeMapping.put("date", "DateTime");
|
||||
} else if ("timemachine".equals(dateLibrary)) {
|
||||
additionalProperties.put("timeMachine", "true");
|
||||
typeMapping.put("date", "OffsetDate");
|
||||
typeMapping.put("Date", "OffsetDate");
|
||||
typeMapping.put("DateTime", "OffsetDateTime");
|
||||
typeMapping.put("datetime", "OffsetDateTime");
|
||||
additionalReservedWords.addAll(Sets.newHashSet("OffsetDate", "OffsetDateTime"));
|
||||
importMapping.put("OffsetDate", "package:time_machine/time_machine.dart");
|
||||
importMapping.put("OffsetDateTime", "package:time_machine/time_machine.dart");
|
||||
supportingFiles.add(new SupportingFile("local_date_serializer.mustache", libFolder, "local_date_serializer.dart"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,13 +251,12 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
Set<String> modelImports = new HashSet<>();
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
for (String modelImport : cm.imports) {
|
||||
if (importMapping().containsKey(modelImport)) {
|
||||
final String value = importMapping().get(modelImport);
|
||||
if (needToImport(value)) {
|
||||
modelImports.add(value);
|
||||
if (needToImport(modelImport)) {
|
||||
if (importMapping().containsKey(modelImport)) {
|
||||
modelImports.add(importMapping().get(modelImport));
|
||||
} else {
|
||||
modelImports.add("package:" + pubName + "/model/" + underscore(modelImport) + ".dart");
|
||||
}
|
||||
} else {
|
||||
modelImports.add("package:" + pubName + "/model/" + underscore(modelImport) + ".dart");
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,18 +323,16 @@ public class DartDioClientCodegen extends DartClientCodegen {
|
||||
|
||||
Set<String> imports = new HashSet<>();
|
||||
for (String item : op.imports) {
|
||||
if (importMapping().containsKey(item)) {
|
||||
final String value = importMapping().get(item);
|
||||
if (needToImport(value)) {
|
||||
fullImports.add(value);
|
||||
if (needToImport(item)) {
|
||||
if (importMapping().containsKey(item) && needToImport(item)) {
|
||||
fullImports.add(importMapping().get(item));
|
||||
} else {
|
||||
imports.add(underscore(item));
|
||||
}
|
||||
} else {
|
||||
imports.add(underscore(item));
|
||||
}
|
||||
}
|
||||
modelImports.addAll(imports);
|
||||
op.imports = imports;
|
||||
|
||||
}
|
||||
|
||||
objs.put("modelImports", modelImports);
|
||||
|
@ -295,10 +295,15 @@ public class DartModelTest {
|
||||
{"sample.name", "SampleName"},
|
||||
{"_sample", "Sample"},
|
||||
{"sample name", "SampleName"},
|
||||
{"List", "ModelList"},
|
||||
{"list", "ModelList"},
|
||||
{"File", "ModelFile"},
|
||||
{"Client", "ModelClient"},
|
||||
{"String", "ModelString"},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "modelNames", description = "avoid inner class")
|
||||
@Test(dataProvider = "modelNames", description = "correctly generate model names")
|
||||
public void modelNameTest(String name, String expectedName) {
|
||||
OpenAPI openAPI = TestUtils.createOpenAPI();
|
||||
final Schema model = new Schema();
|
||||
|
@ -350,14 +350,41 @@ public class DartDioModelTest {
|
||||
public static Object[][] modelNames() {
|
||||
return new Object[][] {
|
||||
{"EnumClass", "ModelEnumClass"},
|
||||
{"JsonObject", "ModelJsonObject"},
|
||||
// OffsetDate is valid without timemachine date library
|
||||
{"OffsetDate", "OffsetDate"},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "modelNames", description = "avoid inner class")
|
||||
@Test(dataProvider = "modelNames", description = "correctly prefix reserved model names")
|
||||
public void modelNameTest(String name, String expectedName) {
|
||||
OpenAPI openAPI = TestUtils.createOpenAPI();
|
||||
final Schema model = new Schema();
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel(name, model);
|
||||
|
||||
Assert.assertEquals(cm.name, name);
|
||||
Assert.assertEquals(cm.classname, expectedName);
|
||||
}
|
||||
|
||||
@DataProvider(name = "modelNamesTimemachine")
|
||||
public static Object[][] modelNamesTimemachine() {
|
||||
return new Object[][] {
|
||||
{"EnumClass", "ModelEnumClass"},
|
||||
{"JsonObject", "ModelJsonObject"},
|
||||
// OffsetDate is not valid with timemachine date library
|
||||
{"OffsetDate", "ModelOffsetDate"},
|
||||
};
|
||||
}
|
||||
|
||||
@Test(dataProvider = "modelNamesTimemachine", description = "correctly prefix reserved model names")
|
||||
public void modelNameTestTimemachine(String name, String expectedName) {
|
||||
OpenAPI openAPI = TestUtils.createOpenAPI();
|
||||
final Schema model = new Schema();
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.setDateLibrary("timemachine");
|
||||
codegen.processOpts();
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel(name, model);
|
||||
|
||||
|
@ -13,7 +13,6 @@ doc/Cat.md
|
||||
doc/CatAllOf.md
|
||||
doc/Category.md
|
||||
doc/ClassModel.md
|
||||
doc/Client.md
|
||||
doc/DefaultApi.md
|
||||
doc/Dog.md
|
||||
doc/DogAllOf.md
|
||||
@ -21,7 +20,6 @@ doc/EnumArrays.md
|
||||
doc/EnumTest.md
|
||||
doc/FakeApi.md
|
||||
doc/FakeClassnameTags123Api.md
|
||||
doc/File.md
|
||||
doc/FileSchemaTestClass.md
|
||||
doc/Foo.md
|
||||
doc/FormatTest.md
|
||||
@ -37,7 +35,10 @@ doc/InlineResponseDefault.md
|
||||
doc/MapTest.md
|
||||
doc/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||
doc/Model200Response.md
|
||||
doc/ModelClient.md
|
||||
doc/ModelEnumClass.md
|
||||
doc/ModelFile.md
|
||||
doc/ModelList.md
|
||||
doc/ModelReturn.md
|
||||
doc/Name.md
|
||||
doc/NullableClass.md
|
||||
@ -80,12 +81,10 @@ lib/model/cat.dart
|
||||
lib/model/cat_all_of.dart
|
||||
lib/model/category.dart
|
||||
lib/model/class_model.dart
|
||||
lib/model/client.dart
|
||||
lib/model/dog.dart
|
||||
lib/model/dog_all_of.dart
|
||||
lib/model/enum_arrays.dart
|
||||
lib/model/enum_test.dart
|
||||
lib/model/file.dart
|
||||
lib/model/file_schema_test_class.dart
|
||||
lib/model/foo.dart
|
||||
lib/model/format_test.dart
|
||||
@ -101,7 +100,10 @@ lib/model/inline_response_default.dart
|
||||
lib/model/map_test.dart
|
||||
lib/model/mixed_properties_and_additional_properties_class.dart
|
||||
lib/model/model200_response.dart
|
||||
lib/model/model_client.dart
|
||||
lib/model/model_enum_class.dart
|
||||
lib/model/model_file.dart
|
||||
lib/model/model_list.dart
|
||||
lib/model/model_return.dart
|
||||
lib/model/name.dart
|
||||
lib/model/nullable_class.dart
|
||||
|
@ -41,10 +41,10 @@ import 'package:openapi/api.dart';
|
||||
|
||||
|
||||
var api_instance = new AnotherFakeApi();
|
||||
var client = new Client(); // Client | client model
|
||||
var modelClient = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
var result = api_instance.call123testSpecialTags(client);
|
||||
var result = api_instance.call123testSpecialTags(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n");
|
||||
@ -112,12 +112,10 @@ Class | Method | HTTP request | Description
|
||||
- [CatAllOf](doc//CatAllOf.md)
|
||||
- [Category](doc//Category.md)
|
||||
- [ClassModel](doc//ClassModel.md)
|
||||
- [Client](doc//Client.md)
|
||||
- [Dog](doc//Dog.md)
|
||||
- [DogAllOf](doc//DogAllOf.md)
|
||||
- [EnumArrays](doc//EnumArrays.md)
|
||||
- [EnumTest](doc//EnumTest.md)
|
||||
- [File](doc//File.md)
|
||||
- [FileSchemaTestClass](doc//FileSchemaTestClass.md)
|
||||
- [Foo](doc//Foo.md)
|
||||
- [FormatTest](doc//FormatTest.md)
|
||||
@ -133,7 +131,10 @@ Class | Method | HTTP request | Description
|
||||
- [MapTest](doc//MapTest.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Model200Response](doc//Model200Response.md)
|
||||
- [ModelClient](doc//ModelClient.md)
|
||||
- [ModelEnumClass](doc//ModelEnumClass.md)
|
||||
- [ModelFile](doc//ModelFile.md)
|
||||
- [ModelList](doc//ModelList.md)
|
||||
- [ModelReturn](doc//ModelReturn.md)
|
||||
- [Name](doc//Name.md)
|
||||
- [NullableClass](doc//NullableClass.md)
|
||||
|
@ -13,7 +13,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **call123testSpecialTags**
|
||||
> Client call123testSpecialTags(client)
|
||||
> ModelClient call123testSpecialTags(modelClient)
|
||||
|
||||
To test special tags
|
||||
|
||||
@ -24,10 +24,10 @@ To test special tags and operation ID starting with number
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
var api_instance = new AnotherFakeApi();
|
||||
var client = new Client(); // Client | client model
|
||||
var modelClient = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
var result = api_instance.call123testSpecialTags(client);
|
||||
var result = api_instance.call123testSpecialTags(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
|
||||
@ -38,11 +38,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
**modelClient** | [**ModelClient**](ModelClient.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
[**ModelClient**](ModelClient.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -367,7 +367,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **testClientModel**
|
||||
> Client testClientModel(client)
|
||||
> ModelClient testClientModel(modelClient)
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
@ -378,10 +378,10 @@ To test \"client\" model
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
var api_instance = new FakeApi();
|
||||
var client = new Client(); // Client | client model
|
||||
var modelClient = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
var result = api_instance.testClientModel(client);
|
||||
var result = api_instance.testClientModel(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling FakeApi->testClientModel: $e\n');
|
||||
@ -392,11 +392,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
**modelClient** | [**ModelClient**](ModelClient.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
[**ModelClient**](ModelClient.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -13,7 +13,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **testClassname**
|
||||
> Client testClassname(client)
|
||||
> ModelClient testClassname(modelClient)
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
@ -28,10 +28,10 @@ import 'package:openapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key_query').apiKeyPrefix = 'Bearer';
|
||||
|
||||
var api_instance = new FakeClassnameTags123Api();
|
||||
var client = new Client(); // Client | client model
|
||||
var modelClient = new ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
var result = api_instance.testClassname(client);
|
||||
var result = api_instance.testClassname(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n');
|
||||
@ -42,11 +42,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
**modelClient** | [**ModelClient**](ModelClient.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
[**ModelClient**](ModelClient.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**file** | [**MultipartFile**](MultipartFile.md) | | [optional] [default to null]
|
||||
**files** | [**BuiltList<MultipartFile>**](MultipartFile.md) | | [optional] [default to const []]
|
||||
**file** | [**ModelFile**](ModelFile.md) | | [optional] [default to null]
|
||||
**files** | [**BuiltList<ModelFile>**](ModelFile.md) | | [optional] [default to const []]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# openapi.model.Client
|
||||
# openapi.model.ModelClient
|
||||
|
||||
## Load the model package
|
||||
```dart
|
@ -1,4 +1,4 @@
|
||||
# openapi.model.File
|
||||
# openapi.model.ModelFile
|
||||
|
||||
## Load the model package
|
||||
```dart
|
@ -0,0 +1,15 @@
|
||||
# openapi.model.ModelList
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**n123list** | **String** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -3,7 +3,7 @@ import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
import 'package:openapi/model/client.dart';
|
||||
import 'package:openapi/model/model_client.dart';
|
||||
|
||||
class AnotherFakeApi {
|
||||
final Dio _dio;
|
||||
@ -14,8 +14,8 @@ class AnotherFakeApi {
|
||||
/// To test special tags
|
||||
///
|
||||
/// To test special tags and operation ID starting with number
|
||||
Future<Response<Client>> call123testSpecialTags(
|
||||
Client client, {
|
||||
Future<Response<ModelClient>> call123testSpecialTags(
|
||||
ModelClient modelClient, {
|
||||
CancelToken cancelToken,
|
||||
Map<String, dynamic> headers,
|
||||
ProgressCallback onSendProgress,
|
||||
@ -34,9 +34,9 @@ class AnotherFakeApi {
|
||||
'application/json',
|
||||
];
|
||||
|
||||
final serializedBody = _serializers.serialize(client);
|
||||
final jsonclient = json.encode(serializedBody);
|
||||
bodyData = jsonclient;
|
||||
final serializedBody = _serializers.serialize(modelClient);
|
||||
final jsonmodelClient = json.encode(serializedBody);
|
||||
bodyData = jsonmodelClient;
|
||||
|
||||
return _dio.request(
|
||||
_path,
|
||||
@ -54,10 +54,10 @@ class AnotherFakeApi {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
final serializer = _serializers.serializerForType(Client);
|
||||
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
|
||||
final serializer = _serializers.serializerForType(ModelClient);
|
||||
final data = _serializers.deserializeWith<ModelClient>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
|
||||
|
||||
return Response<Client>(
|
||||
return Response<ModelClient>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
request: response.request,
|
||||
|
@ -3,12 +3,12 @@ import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
import 'package:openapi/model/client.dart';
|
||||
import 'package:openapi/model/file_schema_test_class.dart';
|
||||
import 'package:openapi/model/outer_composite.dart';
|
||||
import 'package:openapi/model/user.dart';
|
||||
import 'package:openapi/model/health_check_result.dart';
|
||||
import 'package:openapi/model/pet.dart';
|
||||
import 'package:openapi/model/model_client.dart';
|
||||
import 'dart:typed_data';
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/api_util.dart';
|
||||
@ -449,8 +449,8 @@ class FakeApi {
|
||||
/// To test \"client\" model
|
||||
///
|
||||
/// To test \"client\" model
|
||||
Future<Response<Client>> testClientModel(
|
||||
Client client, {
|
||||
Future<Response<ModelClient>> testClientModel(
|
||||
ModelClient modelClient, {
|
||||
CancelToken cancelToken,
|
||||
Map<String, dynamic> headers,
|
||||
ProgressCallback onSendProgress,
|
||||
@ -469,9 +469,9 @@ class FakeApi {
|
||||
'application/json',
|
||||
];
|
||||
|
||||
final serializedBody = _serializers.serialize(client);
|
||||
final jsonclient = json.encode(serializedBody);
|
||||
bodyData = jsonclient;
|
||||
final serializedBody = _serializers.serialize(modelClient);
|
||||
final jsonmodelClient = json.encode(serializedBody);
|
||||
bodyData = jsonmodelClient;
|
||||
|
||||
return _dio.request(
|
||||
_path,
|
||||
@ -489,10 +489,10 @@ class FakeApi {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
final serializer = _serializers.serializerForType(Client);
|
||||
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
|
||||
final serializer = _serializers.serializerForType(ModelClient);
|
||||
final data = _serializers.deserializeWith<ModelClient>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
|
||||
|
||||
return Response<Client>(
|
||||
return Response<ModelClient>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
request: response.request,
|
||||
|
@ -3,7 +3,7 @@ import 'dart:convert';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
import 'package:openapi/model/client.dart';
|
||||
import 'package:openapi/model/model_client.dart';
|
||||
|
||||
class FakeClassnameTags123Api {
|
||||
final Dio _dio;
|
||||
@ -14,8 +14,8 @@ class FakeClassnameTags123Api {
|
||||
/// To test class name in snake case
|
||||
///
|
||||
/// To test class name in snake case
|
||||
Future<Response<Client>> testClassname(
|
||||
Client client, {
|
||||
Future<Response<ModelClient>> testClassname(
|
||||
ModelClient modelClient, {
|
||||
CancelToken cancelToken,
|
||||
Map<String, dynamic> headers,
|
||||
ProgressCallback onSendProgress,
|
||||
@ -34,9 +34,9 @@ class FakeClassnameTags123Api {
|
||||
'application/json',
|
||||
];
|
||||
|
||||
final serializedBody = _serializers.serialize(client);
|
||||
final jsonclient = json.encode(serializedBody);
|
||||
bodyData = jsonclient;
|
||||
final serializedBody = _serializers.serialize(modelClient);
|
||||
final jsonmodelClient = json.encode(serializedBody);
|
||||
bodyData = jsonmodelClient;
|
||||
|
||||
return _dio.request(
|
||||
_path,
|
||||
@ -61,10 +61,10 @@ class FakeClassnameTags123Api {
|
||||
onSendProgress: onSendProgress,
|
||||
onReceiveProgress: onReceiveProgress,
|
||||
).then((response) {
|
||||
final serializer = _serializers.serializerForType(Client);
|
||||
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
|
||||
final serializer = _serializers.serializerForType(ModelClient);
|
||||
final data = _serializers.deserializeWith<ModelClient>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
|
||||
|
||||
return Response<Client>(
|
||||
return Response<ModelClient>(
|
||||
data: data,
|
||||
headers: response.headers,
|
||||
request: response.request,
|
||||
|
@ -1,18 +0,0 @@
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'client.g.dart';
|
||||
|
||||
abstract class Client implements Built<Client, ClientBuilder> {
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: r'client')
|
||||
String get client;
|
||||
|
||||
// Boilerplate code needed to wire-up generated code
|
||||
Client._();
|
||||
|
||||
factory Client([updates(ClientBuilder b)]) = _$Client;
|
||||
static Serializer<Client> get serializer => _$clientSerializer;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import 'package:openapi/model/model_file.dart';
|
||||
import 'package:built_collection/built_collection.dart';
|
||||
import 'package:openapi/model/multipart_file.dart';
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
@ -9,11 +9,11 @@ abstract class FileSchemaTestClass implements Built<FileSchemaTestClass, FileSch
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: r'file')
|
||||
MultipartFile get file;
|
||||
ModelFile get file;
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: r'files')
|
||||
BuiltList<MultipartFile> get files;
|
||||
BuiltList<ModelFile> get files;
|
||||
|
||||
// Boilerplate code needed to wire-up generated code
|
||||
FileSchemaTestClass._();
|
||||
|
@ -0,0 +1,18 @@
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'model_client.g.dart';
|
||||
|
||||
abstract class ModelClient implements Built<ModelClient, ModelClientBuilder> {
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: r'client')
|
||||
String get client;
|
||||
|
||||
// Boilerplate code needed to wire-up generated code
|
||||
ModelClient._();
|
||||
|
||||
factory ModelClient([updates(ModelClientBuilder b)]) = _$ModelClient;
|
||||
static Serializer<ModelClient> get serializer => _$modelClientSerializer;
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'file.g.dart';
|
||||
part 'model_file.g.dart';
|
||||
|
||||
abstract class File implements Built<File, FileBuilder> {
|
||||
abstract class ModelFile implements Built<ModelFile, ModelFileBuilder> {
|
||||
|
||||
/// Test capitalization
|
||||
@nullable
|
||||
@ -11,9 +11,9 @@ abstract class File implements Built<File, FileBuilder> {
|
||||
String get sourceURI;
|
||||
|
||||
// Boilerplate code needed to wire-up generated code
|
||||
File._();
|
||||
ModelFile._();
|
||||
|
||||
factory File([updates(FileBuilder b)]) = _$File;
|
||||
static Serializer<File> get serializer => _$fileSerializer;
|
||||
factory ModelFile([updates(ModelFileBuilder b)]) = _$ModelFile;
|
||||
static Serializer<ModelFile> get serializer => _$modelFileSerializer;
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
import 'package:built_value/built_value.dart';
|
||||
import 'package:built_value/serializer.dart';
|
||||
|
||||
part 'model_list.g.dart';
|
||||
|
||||
abstract class ModelList implements Built<ModelList, ModelListBuilder> {
|
||||
|
||||
@nullable
|
||||
@BuiltValueField(wireName: r'123-list')
|
||||
String get n123list;
|
||||
|
||||
// Boilerplate code needed to wire-up generated code
|
||||
ModelList._();
|
||||
|
||||
factory ModelList([updates(ModelListBuilder b)]) = _$ModelList;
|
||||
static Serializer<ModelList> get serializer => _$modelListSerializer;
|
||||
}
|
||||
|
@ -17,12 +17,10 @@ import 'package:openapi/model/cat.dart';
|
||||
import 'package:openapi/model/cat_all_of.dart';
|
||||
import 'package:openapi/model/category.dart';
|
||||
import 'package:openapi/model/class_model.dart';
|
||||
import 'package:openapi/model/client.dart';
|
||||
import 'package:openapi/model/dog.dart';
|
||||
import 'package:openapi/model/dog_all_of.dart';
|
||||
import 'package:openapi/model/enum_arrays.dart';
|
||||
import 'package:openapi/model/enum_test.dart';
|
||||
import 'package:openapi/model/file.dart';
|
||||
import 'package:openapi/model/file_schema_test_class.dart';
|
||||
import 'package:openapi/model/foo.dart';
|
||||
import 'package:openapi/model/format_test.dart';
|
||||
@ -38,7 +36,10 @@ import 'package:openapi/model/inline_response_default.dart';
|
||||
import 'package:openapi/model/map_test.dart';
|
||||
import 'package:openapi/model/mixed_properties_and_additional_properties_class.dart';
|
||||
import 'package:openapi/model/model200_response.dart';
|
||||
import 'package:openapi/model/model_client.dart';
|
||||
import 'package:openapi/model/model_enum_class.dart';
|
||||
import 'package:openapi/model/model_file.dart';
|
||||
import 'package:openapi/model/model_list.dart';
|
||||
import 'package:openapi/model/model_return.dart';
|
||||
import 'package:openapi/model/name.dart';
|
||||
import 'package:openapi/model/nullable_class.dart';
|
||||
@ -70,12 +71,10 @@ Cat,
|
||||
CatAllOf,
|
||||
Category,
|
||||
ClassModel,
|
||||
Client,
|
||||
Dog,
|
||||
DogAllOf,
|
||||
EnumArrays,
|
||||
EnumTest,
|
||||
File,
|
||||
FileSchemaTestClass,
|
||||
Foo,
|
||||
FormatTest,
|
||||
@ -91,7 +90,10 @@ InlineResponseDefault,
|
||||
MapTest,
|
||||
MixedPropertiesAndAdditionalPropertiesClass,
|
||||
Model200Response,
|
||||
ModelClient,
|
||||
ModelEnumClass,
|
||||
ModelFile,
|
||||
ModelList,
|
||||
ModelReturn,
|
||||
Name,
|
||||
NullableClass,
|
||||
@ -146,9 +148,6 @@ const FullType(BuiltList, const [const FullType(Category)]),
|
||||
const FullType(BuiltList, const [const FullType(ClassModel)]),
|
||||
() => new ListBuilder<ClassModel>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(Client)]),
|
||||
() => new ListBuilder<Client>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(Dog)]),
|
||||
() => new ListBuilder<Dog>())
|
||||
..addBuilderFactory(
|
||||
@ -161,9 +160,6 @@ const FullType(BuiltList, const [const FullType(EnumArrays)]),
|
||||
const FullType(BuiltList, const [const FullType(EnumTest)]),
|
||||
() => new ListBuilder<EnumTest>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(File)]),
|
||||
() => new ListBuilder<File>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(FileSchemaTestClass)]),
|
||||
() => new ListBuilder<FileSchemaTestClass>())
|
||||
..addBuilderFactory(
|
||||
@ -209,9 +205,18 @@ const FullType(BuiltList, const [const FullType(MixedPropertiesAndAdditionalProp
|
||||
const FullType(BuiltList, const [const FullType(Model200Response)]),
|
||||
() => new ListBuilder<Model200Response>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ModelClient)]),
|
||||
() => new ListBuilder<ModelClient>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ModelEnumClass)]),
|
||||
() => new ListBuilder<ModelEnumClass>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ModelFile)]),
|
||||
() => new ListBuilder<ModelFile>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ModelList)]),
|
||||
() => new ListBuilder<ModelList>())
|
||||
..addBuilderFactory(
|
||||
const FullType(BuiltList, const [const FullType(ModelReturn)]),
|
||||
() => new ListBuilder<ModelReturn>())
|
||||
..addBuilderFactory(
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'package:openapi/model/client.dart';
|
||||
import 'package:openapi/model/model_client.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for Client
|
||||
// tests for ModelClient
|
||||
void main() {
|
||||
final instance = Client();
|
||||
final instance = ModelClient();
|
||||
|
||||
group(Client, () {
|
||||
group(ModelClient, () {
|
||||
// String client (default value: null)
|
||||
test('to test the property `client`', () async {
|
||||
// TODO
|
@ -1,11 +1,11 @@
|
||||
import 'package:openapi/model/file.dart';
|
||||
import 'package:openapi/model/model_file.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for File
|
||||
// tests for ModelFile
|
||||
void main() {
|
||||
final instance = File();
|
||||
final instance = ModelFile();
|
||||
|
||||
group(File, () {
|
||||
group(ModelFile, () {
|
||||
// Test capitalization
|
||||
// String sourceURI (default value: null)
|
||||
test('to test the property `sourceURI`', () async {
|
@ -0,0 +1,17 @@
|
||||
import 'package:openapi/model/model_list.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for ModelList
|
||||
void main() {
|
||||
final instance = ModelList();
|
||||
|
||||
group(ModelList, () {
|
||||
// String n123list (default value: null)
|
||||
test('to test the property `n123list`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additionalMetadata** | **String** | Additional data to pass to server | [optional]
|
||||
**file** | [**MultipartFile**](File.md) | file to upload | [optional]
|
||||
**file** | [**MultipartFile**](MultipartFile.md) | file to upload | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -13,7 +13,6 @@ doc/Cat.md
|
||||
doc/CatAllOf.md
|
||||
doc/Category.md
|
||||
doc/ClassModel.md
|
||||
doc/Client.md
|
||||
doc/DefaultApi.md
|
||||
doc/Dog.md
|
||||
doc/DogAllOf.md
|
||||
@ -22,7 +21,6 @@ doc/EnumClass.md
|
||||
doc/EnumTest.md
|
||||
doc/FakeApi.md
|
||||
doc/FakeClassnameTags123Api.md
|
||||
doc/File.md
|
||||
doc/FileSchemaTestClass.md
|
||||
doc/Foo.md
|
||||
doc/FormatTest.md
|
||||
@ -38,6 +36,9 @@ doc/InlineResponseDefault.md
|
||||
doc/MapTest.md
|
||||
doc/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||
doc/Model200Response.md
|
||||
doc/ModelClient.md
|
||||
doc/ModelFile.md
|
||||
doc/ModelList.md
|
||||
doc/ModelReturn.md
|
||||
doc/Name.md
|
||||
doc/NullableClass.md
|
||||
@ -84,13 +85,11 @@ lib/model/cat.dart
|
||||
lib/model/cat_all_of.dart
|
||||
lib/model/category.dart
|
||||
lib/model/class_model.dart
|
||||
lib/model/client.dart
|
||||
lib/model/dog.dart
|
||||
lib/model/dog_all_of.dart
|
||||
lib/model/enum_arrays.dart
|
||||
lib/model/enum_class.dart
|
||||
lib/model/enum_test.dart
|
||||
lib/model/file.dart
|
||||
lib/model/file_schema_test_class.dart
|
||||
lib/model/foo.dart
|
||||
lib/model/format_test.dart
|
||||
@ -106,6 +105,9 @@ lib/model/inline_response_default.dart
|
||||
lib/model/map_test.dart
|
||||
lib/model/mixed_properties_and_additional_properties_class.dart
|
||||
lib/model/model200_response.dart
|
||||
lib/model/model_client.dart
|
||||
lib/model/model_file.dart
|
||||
lib/model/model_list.dart
|
||||
lib/model/model_return.dart
|
||||
lib/model/name.dart
|
||||
lib/model/nullable_class.dart
|
||||
|
@ -41,10 +41,10 @@ import 'package:openapi/api.dart';
|
||||
|
||||
|
||||
final api_instance = AnotherFakeApi();
|
||||
final client = Client(); // Client | client model
|
||||
final modelClient = ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
final result = api_instance.call123testSpecialTags(client);
|
||||
final result = api_instance.call123testSpecialTags(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
|
||||
@ -112,13 +112,11 @@ Class | Method | HTTP request | Description
|
||||
- [CatAllOf](doc//CatAllOf.md)
|
||||
- [Category](doc//Category.md)
|
||||
- [ClassModel](doc//ClassModel.md)
|
||||
- [Client](doc//Client.md)
|
||||
- [Dog](doc//Dog.md)
|
||||
- [DogAllOf](doc//DogAllOf.md)
|
||||
- [EnumArrays](doc//EnumArrays.md)
|
||||
- [EnumClass](doc//EnumClass.md)
|
||||
- [EnumTest](doc//EnumTest.md)
|
||||
- [File](doc//File.md)
|
||||
- [FileSchemaTestClass](doc//FileSchemaTestClass.md)
|
||||
- [Foo](doc//Foo.md)
|
||||
- [FormatTest](doc//FormatTest.md)
|
||||
@ -134,6 +132,9 @@ Class | Method | HTTP request | Description
|
||||
- [MapTest](doc//MapTest.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Model200Response](doc//Model200Response.md)
|
||||
- [ModelClient](doc//ModelClient.md)
|
||||
- [ModelFile](doc//ModelFile.md)
|
||||
- [ModelList](doc//ModelList.md)
|
||||
- [ModelReturn](doc//ModelReturn.md)
|
||||
- [Name](doc//Name.md)
|
||||
- [NullableClass](doc//NullableClass.md)
|
||||
|
@ -13,7 +13,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **call123testSpecialTags**
|
||||
> Client call123testSpecialTags(client)
|
||||
> ModelClient call123testSpecialTags(modelClient)
|
||||
|
||||
To test special tags
|
||||
|
||||
@ -24,10 +24,10 @@ To test special tags and operation ID starting with number
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
final api_instance = AnotherFakeApi();
|
||||
final client = Client(); // Client | client model
|
||||
final modelClient = ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
final result = api_instance.call123testSpecialTags(client);
|
||||
final result = api_instance.call123testSpecialTags(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
|
||||
@ -38,11 +38,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
**modelClient** | [**ModelClient**](ModelClient.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
[**ModelClient**](ModelClient.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -364,7 +364,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **testClientModel**
|
||||
> Client testClientModel(client)
|
||||
> ModelClient testClientModel(modelClient)
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
@ -375,10 +375,10 @@ To test \"client\" model
|
||||
import 'package:openapi/api.dart';
|
||||
|
||||
final api_instance = FakeApi();
|
||||
final client = Client(); // Client | client model
|
||||
final modelClient = ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
final result = api_instance.testClientModel(client);
|
||||
final result = api_instance.testClientModel(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling FakeApi->testClientModel: $e\n');
|
||||
@ -389,11 +389,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
**modelClient** | [**ModelClient**](ModelClient.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
[**ModelClient**](ModelClient.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -13,7 +13,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **testClassname**
|
||||
> Client testClassname(client)
|
||||
> ModelClient testClassname(modelClient)
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
@ -28,10 +28,10 @@ import 'package:openapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key_query').apiKeyPrefix = 'Bearer';
|
||||
|
||||
final api_instance = FakeClassnameTags123Api();
|
||||
final client = Client(); // Client | client model
|
||||
final modelClient = ModelClient(); // ModelClient | client model
|
||||
|
||||
try {
|
||||
final result = api_instance.testClassname(client);
|
||||
final result = api_instance.testClassname(modelClient);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n');
|
||||
@ -42,11 +42,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
**modelClient** | [**ModelClient**](ModelClient.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
[**ModelClient**](ModelClient.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**file** | [**MultipartFile**](MultipartFile.md) | | [optional]
|
||||
**files** | [**List<MultipartFile>**](MultipartFile.md) | | [optional] [default to const []]
|
||||
**file** | [**ModelFile**](ModelFile.md) | | [optional]
|
||||
**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] [default to const []]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -17,7 +17,7 @@ Name | Type | Description | Notes
|
||||
**decimal** | **double** | | [optional]
|
||||
**string** | **String** | | [optional]
|
||||
**byte** | **String** | |
|
||||
**binary** | [**MultipartFile**](File.md) | | [optional]
|
||||
**binary** | [**MultipartFile**](MultipartFile.md) | | [optional]
|
||||
**date** | [**DateTime**](DateTime.md) | |
|
||||
**dateTime** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**uuid** | **String** | | [optional]
|
||||
|
@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additionalMetadata** | **String** | Additional data to pass to server | [optional]
|
||||
**file** | [**MultipartFile**](File.md) | file to upload | [optional]
|
||||
**file** | [**MultipartFile**](MultipartFile.md) | file to upload | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -17,7 +17,7 @@ Name | Type | Description | Notes
|
||||
**string** | **String** | None | [optional]
|
||||
**patternWithoutDelimiter** | **String** | None |
|
||||
**byte** | **String** | None |
|
||||
**binary** | [**MultipartFile**](File.md) | None | [optional]
|
||||
**binary** | [**MultipartFile**](MultipartFile.md) | None | [optional]
|
||||
**date** | [**DateTime**](DateTime.md) | None | [optional]
|
||||
**dateTime** | [**DateTime**](DateTime.md) | None | [optional]
|
||||
**password** | **String** | None | [optional]
|
||||
|
@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**additionalMetadata** | **String** | Additional data to pass to server | [optional]
|
||||
**requiredFile** | [**MultipartFile**](File.md) | file to upload |
|
||||
**requiredFile** | [**MultipartFile**](MultipartFile.md) | file to upload |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# openapi.model.Client
|
||||
# openapi.model.ModelClient
|
||||
|
||||
## Load the model package
|
||||
```dart
|
@ -1,4 +1,4 @@
|
||||
# openapi.model.File
|
||||
# openapi.model.ModelFile
|
||||
|
||||
## Load the model package
|
||||
```dart
|
@ -0,0 +1,15 @@
|
||||
# openapi.model.ModelList
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**n123list** | **String** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -45,13 +45,11 @@ part 'model/cat.dart';
|
||||
part 'model/cat_all_of.dart';
|
||||
part 'model/category.dart';
|
||||
part 'model/class_model.dart';
|
||||
part 'model/client.dart';
|
||||
part 'model/dog.dart';
|
||||
part 'model/dog_all_of.dart';
|
||||
part 'model/enum_arrays.dart';
|
||||
part 'model/enum_class.dart';
|
||||
part 'model/enum_test.dart';
|
||||
part 'model/file.dart';
|
||||
part 'model/file_schema_test_class.dart';
|
||||
part 'model/foo.dart';
|
||||
part 'model/format_test.dart';
|
||||
@ -67,6 +65,9 @@ part 'model/inline_response_default.dart';
|
||||
part 'model/map_test.dart';
|
||||
part 'model/mixed_properties_and_additional_properties_class.dart';
|
||||
part 'model/model200_response.dart';
|
||||
part 'model/model_client.dart';
|
||||
part 'model/model_file.dart';
|
||||
part 'model/model_list.dart';
|
||||
part 'model/model_return.dart';
|
||||
part 'model/name.dart';
|
||||
part 'model/nullable_class.dart';
|
||||
|
@ -23,17 +23,17 @@ class AnotherFakeApi {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [Client] client (required):
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> call123testSpecialTagsWithHttpInfo(Client client) async {
|
||||
Future<Response> call123testSpecialTagsWithHttpInfo(ModelClient modelClient) async {
|
||||
// Verify required params are set.
|
||||
if (client == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: client');
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
final path = '/another-fake/dummy'.replaceAll('{format}', 'json');
|
||||
|
||||
Object postBody = client;
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
@ -73,10 +73,10 @@ class AnotherFakeApi {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [Client] client (required):
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Client> call123testSpecialTags(Client client) async {
|
||||
final response = await call123testSpecialTagsWithHttpInfo(client);
|
||||
Future<ModelClient> call123testSpecialTags(ModelClient modelClient) async {
|
||||
final response = await call123testSpecialTagsWithHttpInfo(modelClient);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
}
|
||||
@ -84,7 +84,7 @@ class AnotherFakeApi {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Client') as Client;
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ModelClient') as ModelClient;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -555,17 +555,17 @@ class FakeApi {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [Client] client (required):
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> testClientModelWithHttpInfo(Client client) async {
|
||||
Future<Response> testClientModelWithHttpInfo(ModelClient modelClient) async {
|
||||
// Verify required params are set.
|
||||
if (client == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: client');
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
final path = '/fake'.replaceAll('{format}', 'json');
|
||||
|
||||
Object postBody = client;
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
@ -605,10 +605,10 @@ class FakeApi {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [Client] client (required):
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Client> testClientModel(Client client) async {
|
||||
final response = await testClientModelWithHttpInfo(client);
|
||||
Future<ModelClient> testClientModel(ModelClient modelClient) async {
|
||||
final response = await testClientModelWithHttpInfo(modelClient);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
}
|
||||
@ -616,7 +616,7 @@ class FakeApi {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Client') as Client;
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ModelClient') as ModelClient;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -23,17 +23,17 @@ class FakeClassnameTags123Api {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [Client] client (required):
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Response> testClassnameWithHttpInfo(Client client) async {
|
||||
Future<Response> testClassnameWithHttpInfo(ModelClient modelClient) async {
|
||||
// Verify required params are set.
|
||||
if (client == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: client');
|
||||
if (modelClient == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
|
||||
}
|
||||
|
||||
final path = '/fake_classname_test'.replaceAll('{format}', 'json');
|
||||
|
||||
Object postBody = client;
|
||||
Object postBody = modelClient;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
@ -73,10 +73,10 @@ class FakeClassnameTags123Api {
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [Client] client (required):
|
||||
/// * [ModelClient] modelClient (required):
|
||||
/// client model
|
||||
Future<Client> testClassname(Client client) async {
|
||||
final response = await testClassnameWithHttpInfo(client);
|
||||
Future<ModelClient> testClassname(ModelClient modelClient) async {
|
||||
final response = await testClassnameWithHttpInfo(modelClient);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
}
|
||||
@ -84,7 +84,7 @@ class FakeClassnameTags123Api {
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'Client') as Client;
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ModelClient') as ModelClient;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -186,8 +186,6 @@ class ApiClient {
|
||||
return Category.fromJson(value);
|
||||
case 'ClassModel':
|
||||
return ClassModel.fromJson(value);
|
||||
case 'Client':
|
||||
return Client.fromJson(value);
|
||||
case 'Dog':
|
||||
return Dog.fromJson(value);
|
||||
case 'DogAllOf':
|
||||
@ -198,8 +196,6 @@ class ApiClient {
|
||||
return EnumClassTypeTransformer().decode(value);
|
||||
case 'EnumTest':
|
||||
return EnumTest.fromJson(value);
|
||||
case 'File':
|
||||
return File.fromJson(value);
|
||||
case 'FileSchemaTestClass':
|
||||
return FileSchemaTestClass.fromJson(value);
|
||||
case 'Foo':
|
||||
@ -230,6 +226,12 @@ class ApiClient {
|
||||
return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value);
|
||||
case 'Model200Response':
|
||||
return Model200Response.fromJson(value);
|
||||
case 'ModelClient':
|
||||
return ModelClient.fromJson(value);
|
||||
case 'ModelFile':
|
||||
return ModelFile.fromJson(value);
|
||||
case 'ModelList':
|
||||
return ModelList.fromJson(value);
|
||||
case 'ModelReturn':
|
||||
return ModelReturn.fromJson(value);
|
||||
case 'Name':
|
||||
|
@ -1,71 +0,0 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.0
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class Client {
|
||||
/// Returns a new [Client] instance.
|
||||
Client({
|
||||
this.client,
|
||||
});
|
||||
|
||||
String client;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is Client &&
|
||||
other.client == client;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(client == null ? 0 : client.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'Client[client=$client]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (client != null) {
|
||||
json[r'client'] = client;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [Client] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static Client fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: Client(
|
||||
client: json[r'client'],
|
||||
);
|
||||
|
||||
static List<Client> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <Client>[]
|
||||
: json.map((v) => Client.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, Client> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, Client>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = Client.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of Client-objects as value to a dart map
|
||||
static Map<String, List<Client>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<Client>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = Client.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -1,72 +0,0 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.0
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class File {
|
||||
/// Returns a new [File] instance.
|
||||
File({
|
||||
this.sourceURI,
|
||||
});
|
||||
|
||||
/// Test capitalization
|
||||
String sourceURI;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is File &&
|
||||
other.sourceURI == sourceURI;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(sourceURI == null ? 0 : sourceURI.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'File[sourceURI=$sourceURI]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (sourceURI != null) {
|
||||
json[r'sourceURI'] = sourceURI;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [File] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static File fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: File(
|
||||
sourceURI: json[r'sourceURI'],
|
||||
);
|
||||
|
||||
static List<File> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <File>[]
|
||||
: json.map((v) => File.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, File> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, File>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = File.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of File-objects as value to a dart map
|
||||
static Map<String, List<File>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<File>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = File.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ class FileSchemaTestClass {
|
||||
this.files = const [],
|
||||
});
|
||||
|
||||
MultipartFile file;
|
||||
ModelFile file;
|
||||
|
||||
List<MultipartFile> files;
|
||||
List<ModelFile> files;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass &&
|
||||
@ -49,8 +49,8 @@ class FileSchemaTestClass {
|
||||
static FileSchemaTestClass fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: FileSchemaTestClass(
|
||||
file: MultipartFile.fromJson(json[r'file']),
|
||||
files: MultipartFile.listFromJson(json[r'files']),
|
||||
file: ModelFile.fromJson(json[r'file']),
|
||||
files: ModelFile.listFromJson(json[r'files']),
|
||||
);
|
||||
|
||||
static List<FileSchemaTestClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
|
@ -0,0 +1,71 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.0
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class ModelClient {
|
||||
/// Returns a new [ModelClient] instance.
|
||||
ModelClient({
|
||||
this.client,
|
||||
});
|
||||
|
||||
String client;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ModelClient &&
|
||||
other.client == client;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(client == null ? 0 : client.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ModelClient[client=$client]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (client != null) {
|
||||
json[r'client'] = client;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [ModelClient] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelClient fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelClient(
|
||||
client: json[r'client'],
|
||||
);
|
||||
|
||||
static List<ModelClient> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelClient>[]
|
||||
: json.map((v) => ModelClient.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, ModelClient> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, ModelClient>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = ModelClient.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelClient-objects as value to a dart map
|
||||
static Map<String, List<ModelClient>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelClient>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = ModelClient.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.0
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class ModelFile {
|
||||
/// Returns a new [ModelFile] instance.
|
||||
ModelFile({
|
||||
this.sourceURI,
|
||||
});
|
||||
|
||||
/// Test capitalization
|
||||
String sourceURI;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ModelFile &&
|
||||
other.sourceURI == sourceURI;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(sourceURI == null ? 0 : sourceURI.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ModelFile[sourceURI=$sourceURI]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (sourceURI != null) {
|
||||
json[r'sourceURI'] = sourceURI;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [ModelFile] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelFile fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelFile(
|
||||
sourceURI: json[r'sourceURI'],
|
||||
);
|
||||
|
||||
static List<ModelFile> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelFile>[]
|
||||
: json.map((v) => ModelFile.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, ModelFile> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, ModelFile>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = ModelFile.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelFile-objects as value to a dart map
|
||||
static Map<String, List<ModelFile>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelFile>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = ModelFile.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.0
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class ModelList {
|
||||
/// Returns a new [ModelList] instance.
|
||||
ModelList({
|
||||
this.n123list,
|
||||
});
|
||||
|
||||
String n123list;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ModelList &&
|
||||
other.n123list == n123list;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(n123list == null ? 0 : n123list.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ModelList[n123list=$n123list]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (n123list != null) {
|
||||
json[r'123-list'] = n123list;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [ModelList] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ModelList fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ModelList(
|
||||
n123list: json[r'123-list'],
|
||||
);
|
||||
|
||||
static List<ModelList> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ModelList>[]
|
||||
: json.map((v) => ModelList.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, ModelList> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, ModelList>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = ModelList.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ModelList-objects as value to a dart map
|
||||
static Map<String, List<ModelList>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ModelList>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = ModelList.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for Client
|
||||
// tests for ModelClient
|
||||
void main() {
|
||||
final instance = Client();
|
||||
final instance = ModelClient();
|
||||
|
||||
group('test Client', () {
|
||||
group('test ModelClient', () {
|
||||
// String client
|
||||
test('to test the property `client`', () async {
|
||||
// TODO
|
@ -1,11 +1,11 @@
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for File
|
||||
// tests for ModelFile
|
||||
void main() {
|
||||
final instance = File();
|
||||
final instance = ModelFile();
|
||||
|
||||
group('test File', () {
|
||||
group('test ModelFile', () {
|
||||
// Test capitalization
|
||||
// String sourceURI
|
||||
test('to test the property `sourceURI`', () async {
|
@ -0,0 +1,17 @@
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for ModelList
|
||||
void main() {
|
||||
final instance = ModelList();
|
||||
|
||||
group('test ModelList', () {
|
||||
// String n123list
|
||||
test('to test the property `n123list`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user