[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:
Peter Leibiger 2020-12-16 10:25:20 +01:00 committed by GitHub
parent 80df0b0004
commit e1c43f1356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 585 additions and 404 deletions

View File

@ -33,19 +33,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|BuiltList|package:built_collection/built_collection.dart| |BuiltList|package:built_collection/built_collection.dart|
|BuiltMap|package:built_collection/built_collection.dart| |BuiltMap|package:built_collection/built_collection.dart|
|BuiltSet|package:built_collection/built_collection.dart| |BuiltSet|package:built_collection/built_collection.dart|
|DateTime|dart:core|
|JsonObject|package:built_value/json_object.dart| |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| |Uint8List|dart:typed_data|
|bool|dart:core|
|double|dart:core|
|dynamic|dart:core|
|int|dart:core|
|num|dart:core|
## INSTANTIATION TYPES ## INSTANTIATION TYPES
@ -62,6 +51,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li> <li>String</li>
<li>bool</li> <li>bool</li>
<li>double</li> <li>double</li>
<li>dynamic</li>
<li>int</li> <li>int</li>
<li>num</li> <li>num</li>
</ul> </ul>

View File

@ -30,17 +30,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Imports | | 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 ## INSTANTIATION TYPES
@ -57,6 +46,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li> <li>String</li>
<li>bool</li> <li>bool</li>
<li>double</li> <li>double</li>
<li>dynamic</li>
<li>int</li> <li>int</li>
<li>num</li> <li>num</li>
</ul> </ul>

View File

@ -28,17 +28,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Imports | | 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 ## INSTANTIATION TYPES
@ -55,6 +44,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>String</li> <li>String</li>
<li>bool</li> <li>bool</li>
<li>double</li> <li>double</li>
<li>dynamic</li>
<li>int</li> <li>int</li>
<li>num</li> <li>num</li>
</ul> </ul>

View File

@ -73,6 +73,10 @@ public class DartClientCodegen extends DefaultCodegen {
protected String apiTestPath = "test" + File.separator; protected String apiTestPath = "test" + File.separator;
protected String modelTestPath = "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() { public DartClientCodegen() {
super(); super();
@ -131,7 +135,8 @@ public class DartClientCodegen extends DefaultCodegen {
"bool", "bool",
"int", "int",
"num", "num",
"double" "double",
"dynamic"
); );
instantiationTypes.put("array", "List"); instantiationTypes.put("array", "List");
instantiationTypes.put("map", "Map"); instantiationTypes.put("map", "Map");
@ -155,7 +160,7 @@ public class DartClientCodegen extends DefaultCodegen {
typeMapping.put("Date", "DateTime"); typeMapping.put("Date", "DateTime");
typeMapping.put("date", "DateTime"); typeMapping.put("date", "DateTime");
typeMapping.put("DateTime", "DateTime"); typeMapping.put("DateTime", "DateTime");
typeMapping.put("File", "MultipartFile"); typeMapping.put("file", "MultipartFile");
typeMapping.put("binary", "MultipartFile"); typeMapping.put("binary", "MultipartFile");
typeMapping.put("UUID", "String"); typeMapping.put("UUID", "String");
typeMapping.put("URI", "String"); typeMapping.put("URI", "String");
@ -163,21 +168,29 @@ public class DartClientCodegen extends DefaultCodegen {
typeMapping.put("object", "Object"); typeMapping.put("object", "Object");
typeMapping.put("AnyType", "Object"); typeMapping.put("AnyType", "Object");
// These are needed as they prevent models from being generated // DataTypes of the above values which are automatically imported.
// which would clash with existing types, e.g. List // They are also not allowed to be model names.
importMapping.put("dynamic", "dart:core"); defaultIncludes = Sets.newHashSet(
importMapping.put("Object", "dart:core"); "String",
importMapping.put("String", "dart:core"); "bool",
importMapping.put("bool", "dart:core"); "int",
importMapping.put("num", "dart:core"); "num",
importMapping.put("int", "dart:core"); "double",
importMapping.put("double", "dart:core"); "dynamic",
importMapping.put("List", "dart:core"); "List",
importMapping.put("Map", "dart:core"); "Set",
importMapping.put("Set", "dart:core"); "Map",
importMapping.put("DateTime", "dart:core"); "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_LIBRARY, "Library name in generated code"));
cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec")); 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")); 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 @Override
public String escapeReservedWord(String name) { public String escapeReservedWord(String name) {
return name + "_"; return name + "_";
@ -370,7 +392,7 @@ public class DartClientCodegen extends DefaultCodegen {
name = "n" + name; name = "n" + name;
} }
if (isReservedWord(name) || importMapping().containsKey(name)) { if (isReservedWord(name)) {
name = escapeReservedWord(name); name = escapeReservedWord(name);
} }
@ -385,10 +407,6 @@ public class DartClientCodegen extends DefaultCodegen {
@Override @Override
public String toModelName(final String name) { public String toModelName(final String name) {
if (importMapping().containsKey(name)) {
return name;
}
String nameWithPrefixSuffix = sanitizeName(name); String nameWithPrefixSuffix = sanitizeName(name);
if (!StringUtils.isEmpty(modelNamePrefix)) { if (!StringUtils.isEmpty(modelNamePrefix)) {
// add '_' so that model name can be camelized correctly // add '_' so that model name can be camelized correctly

View File

@ -19,14 +19,9 @@ package org.openapitools.codegen.languages;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Mustache;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption; import org.openapitools.codegen.*;
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.utils.ModelUtils; import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.ProcessUtils; import org.openapitools.codegen.utils.ProcessUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -35,8 +30,6 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import io.swagger.v3.oas.models.media.Schema;
import static org.openapitools.codegen.utils.StringUtils.underscore; import static org.openapitools.codegen.utils.StringUtils.underscore;
public class DartDioClientCodegen extends DartClientCodegen { public class DartDioClientCodegen extends DartClientCodegen {
@ -49,7 +42,6 @@ public class DartDioClientCodegen extends DartClientCodegen {
private boolean nullableFields = true; private boolean nullableFields = true;
private String dateLibrary = "core"; private String dateLibrary = "core";
private static final Set<String> reservedBuiltValueWords = Sets.newHashSet("EnumClass");
public DartDioClientCodegen() { public DartDioClientCodegen() {
super(); super();
@ -75,6 +67,17 @@ public class DartDioClientCodegen extends DartClientCodegen {
typeMapping.put("object", "JsonObject"); typeMapping.put("object", "JsonObject");
typeMapping.put("AnyType", "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("BuiltList", "package:built_collection/built_collection.dart");
importMapping.put("BuiltSet", "package:built_collection/built_collection.dart"); importMapping.put("BuiltSet", "package:built_collection/built_collection.dart");
importMapping.put("BuiltMap", "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."; return "Generates a Dart Dio client library.";
} }
@Override
protected boolean isReservedWord(String word) {
return super.isReservedWord(word) || reservedBuiltValueWords.contains(word);
}
@Override @Override
protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() { protected ImmutableMap.Builder<String, Mustache.Lambda> addMustacheLambdas() {
return super.addMustacheLambdas() return super.addMustacheLambdas()
@ -227,19 +225,18 @@ public class DartDioClientCodegen extends DartClientCodegen {
supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart")); supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart"));
if ("core".equals(dateLibrary)) { if ("core".equals(dateLibrary)) {
// this option uses the same classes as normal dart generator
additionalProperties.put("core", "true"); additionalProperties.put("core", "true");
typeMapping.put("Date", "DateTime");
typeMapping.put("date", "DateTime");
} else if ("timemachine".equals(dateLibrary)) { } else if ("timemachine".equals(dateLibrary)) {
additionalProperties.put("timeMachine", "true"); additionalProperties.put("timeMachine", "true");
typeMapping.put("date", "OffsetDate"); typeMapping.put("date", "OffsetDate");
typeMapping.put("Date", "OffsetDate"); typeMapping.put("Date", "OffsetDate");
typeMapping.put("DateTime", "OffsetDateTime"); typeMapping.put("DateTime", "OffsetDateTime");
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("OffsetDate", "package:time_machine/time_machine.dart");
importMapping.put("OffsetDateTime", "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")); 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<>(); Set<String> modelImports = new HashSet<>();
CodegenModel cm = (CodegenModel) mo.get("model"); CodegenModel cm = (CodegenModel) mo.get("model");
for (String modelImport : cm.imports) { for (String modelImport : cm.imports) {
if (importMapping().containsKey(modelImport)) { if (needToImport(modelImport)) {
final String value = importMapping().get(modelImport); if (importMapping().containsKey(modelImport)) {
if (needToImport(value)) { modelImports.add(importMapping().get(modelImport));
modelImports.add(value); } 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<>(); Set<String> imports = new HashSet<>();
for (String item : op.imports) { for (String item : op.imports) {
if (importMapping().containsKey(item)) { if (needToImport(item)) {
final String value = importMapping().get(item); if (importMapping().containsKey(item) && needToImport(item)) {
if (needToImport(value)) { fullImports.add(importMapping().get(item));
fullImports.add(value); } else {
imports.add(underscore(item));
} }
} else {
imports.add(underscore(item));
} }
} }
modelImports.addAll(imports); modelImports.addAll(imports);
op.imports = imports; op.imports = imports;
} }
objs.put("modelImports", modelImports); objs.put("modelImports", modelImports);

View File

@ -295,10 +295,15 @@ public class DartModelTest {
{"sample.name", "SampleName"}, {"sample.name", "SampleName"},
{"_sample", "Sample"}, {"_sample", "Sample"},
{"sample name", "SampleName"}, {"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) { public void modelNameTest(String name, String expectedName) {
OpenAPI openAPI = TestUtils.createOpenAPI(); OpenAPI openAPI = TestUtils.createOpenAPI();
final Schema model = new Schema(); final Schema model = new Schema();

View File

@ -350,14 +350,41 @@ public class DartDioModelTest {
public static Object[][] modelNames() { public static Object[][] modelNames() {
return new Object[][] { return new Object[][] {
{"EnumClass", "ModelEnumClass"}, {"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) { public void modelNameTest(String name, String expectedName) {
OpenAPI openAPI = TestUtils.createOpenAPI(); OpenAPI openAPI = TestUtils.createOpenAPI();
final Schema model = new Schema(); 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); codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel(name, model); final CodegenModel cm = codegen.fromModel(name, model);

View File

@ -13,7 +13,6 @@ doc/Cat.md
doc/CatAllOf.md doc/CatAllOf.md
doc/Category.md doc/Category.md
doc/ClassModel.md doc/ClassModel.md
doc/Client.md
doc/DefaultApi.md doc/DefaultApi.md
doc/Dog.md doc/Dog.md
doc/DogAllOf.md doc/DogAllOf.md
@ -21,7 +20,6 @@ doc/EnumArrays.md
doc/EnumTest.md doc/EnumTest.md
doc/FakeApi.md doc/FakeApi.md
doc/FakeClassnameTags123Api.md doc/FakeClassnameTags123Api.md
doc/File.md
doc/FileSchemaTestClass.md doc/FileSchemaTestClass.md
doc/Foo.md doc/Foo.md
doc/FormatTest.md doc/FormatTest.md
@ -37,7 +35,10 @@ doc/InlineResponseDefault.md
doc/MapTest.md doc/MapTest.md
doc/MixedPropertiesAndAdditionalPropertiesClass.md doc/MixedPropertiesAndAdditionalPropertiesClass.md
doc/Model200Response.md doc/Model200Response.md
doc/ModelClient.md
doc/ModelEnumClass.md doc/ModelEnumClass.md
doc/ModelFile.md
doc/ModelList.md
doc/ModelReturn.md doc/ModelReturn.md
doc/Name.md doc/Name.md
doc/NullableClass.md doc/NullableClass.md
@ -80,12 +81,10 @@ lib/model/cat.dart
lib/model/cat_all_of.dart lib/model/cat_all_of.dart
lib/model/category.dart lib/model/category.dart
lib/model/class_model.dart lib/model/class_model.dart
lib/model/client.dart
lib/model/dog.dart lib/model/dog.dart
lib/model/dog_all_of.dart lib/model/dog_all_of.dart
lib/model/enum_arrays.dart lib/model/enum_arrays.dart
lib/model/enum_test.dart lib/model/enum_test.dart
lib/model/file.dart
lib/model/file_schema_test_class.dart lib/model/file_schema_test_class.dart
lib/model/foo.dart lib/model/foo.dart
lib/model/format_test.dart lib/model/format_test.dart
@ -101,7 +100,10 @@ lib/model/inline_response_default.dart
lib/model/map_test.dart lib/model/map_test.dart
lib/model/mixed_properties_and_additional_properties_class.dart lib/model/mixed_properties_and_additional_properties_class.dart
lib/model/model200_response.dart lib/model/model200_response.dart
lib/model/model_client.dart
lib/model/model_enum_class.dart lib/model/model_enum_class.dart
lib/model/model_file.dart
lib/model/model_list.dart
lib/model/model_return.dart lib/model/model_return.dart
lib/model/name.dart lib/model/name.dart
lib/model/nullable_class.dart lib/model/nullable_class.dart

View File

@ -41,10 +41,10 @@ import 'package:openapi/api.dart';
var api_instance = new AnotherFakeApi(); var api_instance = new AnotherFakeApi();
var client = new Client(); // Client | client model var modelClient = new ModelClient(); // ModelClient | client model
try { try {
var result = api_instance.call123testSpecialTags(client); var result = api_instance.call123testSpecialTags(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n");
@ -112,12 +112,10 @@ Class | Method | HTTP request | Description
- [CatAllOf](doc//CatAllOf.md) - [CatAllOf](doc//CatAllOf.md)
- [Category](doc//Category.md) - [Category](doc//Category.md)
- [ClassModel](doc//ClassModel.md) - [ClassModel](doc//ClassModel.md)
- [Client](doc//Client.md)
- [Dog](doc//Dog.md) - [Dog](doc//Dog.md)
- [DogAllOf](doc//DogAllOf.md) - [DogAllOf](doc//DogAllOf.md)
- [EnumArrays](doc//EnumArrays.md) - [EnumArrays](doc//EnumArrays.md)
- [EnumTest](doc//EnumTest.md) - [EnumTest](doc//EnumTest.md)
- [File](doc//File.md)
- [FileSchemaTestClass](doc//FileSchemaTestClass.md) - [FileSchemaTestClass](doc//FileSchemaTestClass.md)
- [Foo](doc//Foo.md) - [Foo](doc//Foo.md)
- [FormatTest](doc//FormatTest.md) - [FormatTest](doc//FormatTest.md)
@ -133,7 +131,10 @@ Class | Method | HTTP request | Description
- [MapTest](doc//MapTest.md) - [MapTest](doc//MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model200Response](doc//Model200Response.md) - [Model200Response](doc//Model200Response.md)
- [ModelClient](doc//ModelClient.md)
- [ModelEnumClass](doc//ModelEnumClass.md) - [ModelEnumClass](doc//ModelEnumClass.md)
- [ModelFile](doc//ModelFile.md)
- [ModelList](doc//ModelList.md)
- [ModelReturn](doc//ModelReturn.md) - [ModelReturn](doc//ModelReturn.md)
- [Name](doc//Name.md) - [Name](doc//Name.md)
- [NullableClass](doc//NullableClass.md) - [NullableClass](doc//NullableClass.md)

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
# **call123testSpecialTags** # **call123testSpecialTags**
> Client call123testSpecialTags(client) > ModelClient call123testSpecialTags(modelClient)
To test special tags To test special tags
@ -24,10 +24,10 @@ To test special tags and operation ID starting with number
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
var api_instance = new AnotherFakeApi(); var api_instance = new AnotherFakeApi();
var client = new Client(); // Client | client model var modelClient = new ModelClient(); // ModelClient | client model
try { try {
var result = api_instance.call123testSpecialTags(client); var result = api_instance.call123testSpecialTags(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
@ -38,11 +38,11 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model | **modelClient** | [**ModelClient**](ModelClient.md)| client model |
### Return type ### Return type
[**Client**](Client.md) [**ModelClient**](ModelClient.md)
### Authorization ### Authorization

View File

@ -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) [[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** # **testClientModel**
> Client testClientModel(client) > ModelClient testClientModel(modelClient)
To test \"client\" model To test \"client\" model
@ -378,10 +378,10 @@ To test \"client\" model
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
var api_instance = new FakeApi(); var api_instance = new FakeApi();
var client = new Client(); // Client | client model var modelClient = new ModelClient(); // ModelClient | client model
try { try {
var result = api_instance.testClientModel(client); var result = api_instance.testClientModel(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling FakeApi->testClientModel: $e\n'); print('Exception when calling FakeApi->testClientModel: $e\n');
@ -392,11 +392,11 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model | **modelClient** | [**ModelClient**](ModelClient.md)| client model |
### Return type ### Return type
[**Client**](Client.md) [**ModelClient**](ModelClient.md)
### Authorization ### Authorization

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
# **testClassname** # **testClassname**
> Client testClassname(client) > ModelClient testClassname(modelClient)
To test class name in snake case To test class name in snake case
@ -28,10 +28,10 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key_query').apiKeyPrefix = 'Bearer'; //defaultApiClient.getAuthentication<ApiKeyAuth>('api_key_query').apiKeyPrefix = 'Bearer';
var api_instance = new FakeClassnameTags123Api(); var api_instance = new FakeClassnameTags123Api();
var client = new Client(); // Client | client model var modelClient = new ModelClient(); // ModelClient | client model
try { try {
var result = api_instance.testClassname(client); var result = api_instance.testClassname(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n');
@ -42,11 +42,11 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model | **modelClient** | [**ModelClient**](ModelClient.md)| client model |
### Return type ### Return type
[**Client**](Client.md) [**ModelClient**](ModelClient.md)
### Authorization ### Authorization

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**file** | [**MultipartFile**](MultipartFile.md) | | [optional] [default to null] **file** | [**ModelFile**](ModelFile.md) | | [optional] [default to null]
**files** | [**BuiltList<MultipartFile>**](MultipartFile.md) | | [optional] [default to const []] **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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,4 +1,4 @@
# openapi.model.Client # openapi.model.ModelClient
## Load the model package ## Load the model package
```dart ```dart

View File

@ -1,4 +1,4 @@
# openapi.model.File # openapi.model.ModelFile
## Load the model package ## Load the model package
```dart ```dart

View File

@ -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)

View File

@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart'; import 'package:built_value/serializer.dart';
import 'package:openapi/model/client.dart'; import 'package:openapi/model/model_client.dart';
class AnotherFakeApi { class AnotherFakeApi {
final Dio _dio; final Dio _dio;
@ -14,8 +14,8 @@ class AnotherFakeApi {
/// To test special tags /// To test special tags
/// ///
/// To test special tags and operation ID starting with number /// To test special tags and operation ID starting with number
Future<Response<Client>> call123testSpecialTags( Future<Response<ModelClient>> call123testSpecialTags(
Client client, { ModelClient modelClient, {
CancelToken cancelToken, CancelToken cancelToken,
Map<String, dynamic> headers, Map<String, dynamic> headers,
ProgressCallback onSendProgress, ProgressCallback onSendProgress,
@ -34,9 +34,9 @@ class AnotherFakeApi {
'application/json', 'application/json',
]; ];
final serializedBody = _serializers.serialize(client); final serializedBody = _serializers.serialize(modelClient);
final jsonclient = json.encode(serializedBody); final jsonmodelClient = json.encode(serializedBody);
bodyData = jsonclient; bodyData = jsonmodelClient;
return _dio.request( return _dio.request(
_path, _path,
@ -54,10 +54,10 @@ class AnotherFakeApi {
onSendProgress: onSendProgress, onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress, onReceiveProgress: onReceiveProgress,
).then((response) { ).then((response) {
final serializer = _serializers.serializerForType(Client); final serializer = _serializers.serializerForType(ModelClient);
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data); final data = _serializers.deserializeWith<ModelClient>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
return Response<Client>( return Response<ModelClient>(
data: data, data: data,
headers: response.headers, headers: response.headers,
request: response.request, request: response.request,

View File

@ -3,12 +3,12 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:built_value/serializer.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/file_schema_test_class.dart';
import 'package:openapi/model/outer_composite.dart'; import 'package:openapi/model/outer_composite.dart';
import 'package:openapi/model/user.dart'; import 'package:openapi/model/user.dart';
import 'package:openapi/model/health_check_result.dart'; import 'package:openapi/model/health_check_result.dart';
import 'package:openapi/model/pet.dart'; import 'package:openapi/model/pet.dart';
import 'package:openapi/model/model_client.dart';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:built_collection/built_collection.dart'; import 'package:built_collection/built_collection.dart';
import 'package:openapi/api_util.dart'; import 'package:openapi/api_util.dart';
@ -449,8 +449,8 @@ class FakeApi {
/// To test \"client\" model /// To test \"client\" model
/// ///
/// To test \"client\" model /// To test \"client\" model
Future<Response<Client>> testClientModel( Future<Response<ModelClient>> testClientModel(
Client client, { ModelClient modelClient, {
CancelToken cancelToken, CancelToken cancelToken,
Map<String, dynamic> headers, Map<String, dynamic> headers,
ProgressCallback onSendProgress, ProgressCallback onSendProgress,
@ -469,9 +469,9 @@ class FakeApi {
'application/json', 'application/json',
]; ];
final serializedBody = _serializers.serialize(client); final serializedBody = _serializers.serialize(modelClient);
final jsonclient = json.encode(serializedBody); final jsonmodelClient = json.encode(serializedBody);
bodyData = jsonclient; bodyData = jsonmodelClient;
return _dio.request( return _dio.request(
_path, _path,
@ -489,10 +489,10 @@ class FakeApi {
onSendProgress: onSendProgress, onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress, onReceiveProgress: onReceiveProgress,
).then((response) { ).then((response) {
final serializer = _serializers.serializerForType(Client); final serializer = _serializers.serializerForType(ModelClient);
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data); final data = _serializers.deserializeWith<ModelClient>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
return Response<Client>( return Response<ModelClient>(
data: data, data: data,
headers: response.headers, headers: response.headers,
request: response.request, request: response.request,

View File

@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:built_value/serializer.dart'; import 'package:built_value/serializer.dart';
import 'package:openapi/model/client.dart'; import 'package:openapi/model/model_client.dart';
class FakeClassnameTags123Api { class FakeClassnameTags123Api {
final Dio _dio; final Dio _dio;
@ -14,8 +14,8 @@ class FakeClassnameTags123Api {
/// To test class name in snake case /// To test class name in snake case
/// ///
/// To test class name in snake case /// To test class name in snake case
Future<Response<Client>> testClassname( Future<Response<ModelClient>> testClassname(
Client client, { ModelClient modelClient, {
CancelToken cancelToken, CancelToken cancelToken,
Map<String, dynamic> headers, Map<String, dynamic> headers,
ProgressCallback onSendProgress, ProgressCallback onSendProgress,
@ -34,9 +34,9 @@ class FakeClassnameTags123Api {
'application/json', 'application/json',
]; ];
final serializedBody = _serializers.serialize(client); final serializedBody = _serializers.serialize(modelClient);
final jsonclient = json.encode(serializedBody); final jsonmodelClient = json.encode(serializedBody);
bodyData = jsonclient; bodyData = jsonmodelClient;
return _dio.request( return _dio.request(
_path, _path,
@ -61,10 +61,10 @@ class FakeClassnameTags123Api {
onSendProgress: onSendProgress, onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress, onReceiveProgress: onReceiveProgress,
).then((response) { ).then((response) {
final serializer = _serializers.serializerForType(Client); final serializer = _serializers.serializerForType(ModelClient);
final data = _serializers.deserializeWith<Client>(serializer, response.data is String ? jsonDecode(response.data) : response.data); final data = _serializers.deserializeWith<ModelClient>(serializer, response.data is String ? jsonDecode(response.data) : response.data);
return Response<Client>( return Response<ModelClient>(
data: data, data: data,
headers: response.headers, headers: response.headers,
request: response.request, request: response.request,

View File

@ -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;
}

View File

@ -1,5 +1,5 @@
import 'package:openapi/model/model_file.dart';
import 'package:built_collection/built_collection.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/built_value.dart';
import 'package:built_value/serializer.dart'; import 'package:built_value/serializer.dart';
@ -9,11 +9,11 @@ abstract class FileSchemaTestClass implements Built<FileSchemaTestClass, FileSch
@nullable @nullable
@BuiltValueField(wireName: r'file') @BuiltValueField(wireName: r'file')
MultipartFile get file; ModelFile get file;
@nullable @nullable
@BuiltValueField(wireName: r'files') @BuiltValueField(wireName: r'files')
BuiltList<MultipartFile> get files; BuiltList<ModelFile> get files;
// Boilerplate code needed to wire-up generated code // Boilerplate code needed to wire-up generated code
FileSchemaTestClass._(); FileSchemaTestClass._();

View File

@ -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;
}

View File

@ -1,9 +1,9 @@
import 'package:built_value/built_value.dart'; import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.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 /// Test capitalization
@nullable @nullable
@ -11,9 +11,9 @@ abstract class File implements Built<File, FileBuilder> {
String get sourceURI; String get sourceURI;
// Boilerplate code needed to wire-up generated code // Boilerplate code needed to wire-up generated code
File._(); ModelFile._();
factory File([updates(FileBuilder b)]) = _$File; factory ModelFile([updates(ModelFileBuilder b)]) = _$ModelFile;
static Serializer<File> get serializer => _$fileSerializer; static Serializer<ModelFile> get serializer => _$modelFileSerializer;
} }

View File

@ -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;
}

View File

@ -17,12 +17,10 @@ import 'package:openapi/model/cat.dart';
import 'package:openapi/model/cat_all_of.dart'; import 'package:openapi/model/cat_all_of.dart';
import 'package:openapi/model/category.dart'; import 'package:openapi/model/category.dart';
import 'package:openapi/model/class_model.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.dart';
import 'package:openapi/model/dog_all_of.dart'; import 'package:openapi/model/dog_all_of.dart';
import 'package:openapi/model/enum_arrays.dart'; import 'package:openapi/model/enum_arrays.dart';
import 'package:openapi/model/enum_test.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/file_schema_test_class.dart';
import 'package:openapi/model/foo.dart'; import 'package:openapi/model/foo.dart';
import 'package:openapi/model/format_test.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/map_test.dart';
import 'package:openapi/model/mixed_properties_and_additional_properties_class.dart'; import 'package:openapi/model/mixed_properties_and_additional_properties_class.dart';
import 'package:openapi/model/model200_response.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_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/model_return.dart';
import 'package:openapi/model/name.dart'; import 'package:openapi/model/name.dart';
import 'package:openapi/model/nullable_class.dart'; import 'package:openapi/model/nullable_class.dart';
@ -70,12 +71,10 @@ Cat,
CatAllOf, CatAllOf,
Category, Category,
ClassModel, ClassModel,
Client,
Dog, Dog,
DogAllOf, DogAllOf,
EnumArrays, EnumArrays,
EnumTest, EnumTest,
File,
FileSchemaTestClass, FileSchemaTestClass,
Foo, Foo,
FormatTest, FormatTest,
@ -91,7 +90,10 @@ InlineResponseDefault,
MapTest, MapTest,
MixedPropertiesAndAdditionalPropertiesClass, MixedPropertiesAndAdditionalPropertiesClass,
Model200Response, Model200Response,
ModelClient,
ModelEnumClass, ModelEnumClass,
ModelFile,
ModelList,
ModelReturn, ModelReturn,
Name, Name,
NullableClass, NullableClass,
@ -146,9 +148,6 @@ const FullType(BuiltList, const [const FullType(Category)]),
const FullType(BuiltList, const [const FullType(ClassModel)]), const FullType(BuiltList, const [const FullType(ClassModel)]),
() => new ListBuilder<ClassModel>()) () => new ListBuilder<ClassModel>())
..addBuilderFactory( ..addBuilderFactory(
const FullType(BuiltList, const [const FullType(Client)]),
() => new ListBuilder<Client>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(Dog)]), const FullType(BuiltList, const [const FullType(Dog)]),
() => new ListBuilder<Dog>()) () => new ListBuilder<Dog>())
..addBuilderFactory( ..addBuilderFactory(
@ -161,9 +160,6 @@ const FullType(BuiltList, const [const FullType(EnumArrays)]),
const FullType(BuiltList, const [const FullType(EnumTest)]), const FullType(BuiltList, const [const FullType(EnumTest)]),
() => new ListBuilder<EnumTest>()) () => new ListBuilder<EnumTest>())
..addBuilderFactory( ..addBuilderFactory(
const FullType(BuiltList, const [const FullType(File)]),
() => new ListBuilder<File>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(FileSchemaTestClass)]), const FullType(BuiltList, const [const FullType(FileSchemaTestClass)]),
() => new ListBuilder<FileSchemaTestClass>()) () => new ListBuilder<FileSchemaTestClass>())
..addBuilderFactory( ..addBuilderFactory(
@ -209,9 +205,18 @@ const FullType(BuiltList, const [const FullType(MixedPropertiesAndAdditionalProp
const FullType(BuiltList, const [const FullType(Model200Response)]), const FullType(BuiltList, const [const FullType(Model200Response)]),
() => new ListBuilder<Model200Response>()) () => new ListBuilder<Model200Response>())
..addBuilderFactory( ..addBuilderFactory(
const FullType(BuiltList, const [const FullType(ModelClient)]),
() => new ListBuilder<ModelClient>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(ModelEnumClass)]), const FullType(BuiltList, const [const FullType(ModelEnumClass)]),
() => new ListBuilder<ModelEnumClass>()) () => new ListBuilder<ModelEnumClass>())
..addBuilderFactory( ..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)]), const FullType(BuiltList, const [const FullType(ModelReturn)]),
() => new ListBuilder<ModelReturn>()) () => new ListBuilder<ModelReturn>())
..addBuilderFactory( ..addBuilderFactory(

View File

@ -1,11 +1,11 @@
import 'package:openapi/model/client.dart'; import 'package:openapi/model/model_client.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
// tests for Client // tests for ModelClient
void main() { void main() {
final instance = Client(); final instance = ModelClient();
group(Client, () { group(ModelClient, () {
// String client (default value: null) // String client (default value: null)
test('to test the property `client`', () async { test('to test the property `client`', () async {
// TODO // TODO

View File

@ -1,11 +1,11 @@
import 'package:openapi/model/file.dart'; import 'package:openapi/model/model_file.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
// tests for File // tests for ModelFile
void main() { void main() {
final instance = File(); final instance = ModelFile();
group(File, () { group(ModelFile, () {
// Test capitalization // Test capitalization
// String sourceURI (default value: null) // String sourceURI (default value: null)
test('to test the property `sourceURI`', () async { test('to test the property `sourceURI`', () async {

View File

@ -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
});
});
}

View File

@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**additionalMetadata** | **String** | Additional data to pass to server | [optional] **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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -13,7 +13,6 @@ doc/Cat.md
doc/CatAllOf.md doc/CatAllOf.md
doc/Category.md doc/Category.md
doc/ClassModel.md doc/ClassModel.md
doc/Client.md
doc/DefaultApi.md doc/DefaultApi.md
doc/Dog.md doc/Dog.md
doc/DogAllOf.md doc/DogAllOf.md
@ -22,7 +21,6 @@ doc/EnumClass.md
doc/EnumTest.md doc/EnumTest.md
doc/FakeApi.md doc/FakeApi.md
doc/FakeClassnameTags123Api.md doc/FakeClassnameTags123Api.md
doc/File.md
doc/FileSchemaTestClass.md doc/FileSchemaTestClass.md
doc/Foo.md doc/Foo.md
doc/FormatTest.md doc/FormatTest.md
@ -38,6 +36,9 @@ doc/InlineResponseDefault.md
doc/MapTest.md doc/MapTest.md
doc/MixedPropertiesAndAdditionalPropertiesClass.md doc/MixedPropertiesAndAdditionalPropertiesClass.md
doc/Model200Response.md doc/Model200Response.md
doc/ModelClient.md
doc/ModelFile.md
doc/ModelList.md
doc/ModelReturn.md doc/ModelReturn.md
doc/Name.md doc/Name.md
doc/NullableClass.md doc/NullableClass.md
@ -84,13 +85,11 @@ lib/model/cat.dart
lib/model/cat_all_of.dart lib/model/cat_all_of.dart
lib/model/category.dart lib/model/category.dart
lib/model/class_model.dart lib/model/class_model.dart
lib/model/client.dart
lib/model/dog.dart lib/model/dog.dart
lib/model/dog_all_of.dart lib/model/dog_all_of.dart
lib/model/enum_arrays.dart lib/model/enum_arrays.dart
lib/model/enum_class.dart lib/model/enum_class.dart
lib/model/enum_test.dart lib/model/enum_test.dart
lib/model/file.dart
lib/model/file_schema_test_class.dart lib/model/file_schema_test_class.dart
lib/model/foo.dart lib/model/foo.dart
lib/model/format_test.dart lib/model/format_test.dart
@ -106,6 +105,9 @@ lib/model/inline_response_default.dart
lib/model/map_test.dart lib/model/map_test.dart
lib/model/mixed_properties_and_additional_properties_class.dart lib/model/mixed_properties_and_additional_properties_class.dart
lib/model/model200_response.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/model_return.dart
lib/model/name.dart lib/model/name.dart
lib/model/nullable_class.dart lib/model/nullable_class.dart

View File

@ -41,10 +41,10 @@ import 'package:openapi/api.dart';
final api_instance = AnotherFakeApi(); final api_instance = AnotherFakeApi();
final client = Client(); // Client | client model final modelClient = ModelClient(); // ModelClient | client model
try { try {
final result = api_instance.call123testSpecialTags(client); final result = api_instance.call123testSpecialTags(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
@ -112,13 +112,11 @@ Class | Method | HTTP request | Description
- [CatAllOf](doc//CatAllOf.md) - [CatAllOf](doc//CatAllOf.md)
- [Category](doc//Category.md) - [Category](doc//Category.md)
- [ClassModel](doc//ClassModel.md) - [ClassModel](doc//ClassModel.md)
- [Client](doc//Client.md)
- [Dog](doc//Dog.md) - [Dog](doc//Dog.md)
- [DogAllOf](doc//DogAllOf.md) - [DogAllOf](doc//DogAllOf.md)
- [EnumArrays](doc//EnumArrays.md) - [EnumArrays](doc//EnumArrays.md)
- [EnumClass](doc//EnumClass.md) - [EnumClass](doc//EnumClass.md)
- [EnumTest](doc//EnumTest.md) - [EnumTest](doc//EnumTest.md)
- [File](doc//File.md)
- [FileSchemaTestClass](doc//FileSchemaTestClass.md) - [FileSchemaTestClass](doc//FileSchemaTestClass.md)
- [Foo](doc//Foo.md) - [Foo](doc//Foo.md)
- [FormatTest](doc//FormatTest.md) - [FormatTest](doc//FormatTest.md)
@ -134,6 +132,9 @@ Class | Method | HTTP request | Description
- [MapTest](doc//MapTest.md) - [MapTest](doc//MapTest.md)
- [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md)
- [Model200Response](doc//Model200Response.md) - [Model200Response](doc//Model200Response.md)
- [ModelClient](doc//ModelClient.md)
- [ModelFile](doc//ModelFile.md)
- [ModelList](doc//ModelList.md)
- [ModelReturn](doc//ModelReturn.md) - [ModelReturn](doc//ModelReturn.md)
- [Name](doc//Name.md) - [Name](doc//Name.md)
- [NullableClass](doc//NullableClass.md) - [NullableClass](doc//NullableClass.md)

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
# **call123testSpecialTags** # **call123testSpecialTags**
> Client call123testSpecialTags(client) > ModelClient call123testSpecialTags(modelClient)
To test special tags To test special tags
@ -24,10 +24,10 @@ To test special tags and operation ID starting with number
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
final api_instance = AnotherFakeApi(); final api_instance = AnotherFakeApi();
final client = Client(); // Client | client model final modelClient = ModelClient(); // ModelClient | client model
try { try {
final result = api_instance.call123testSpecialTags(client); final result = api_instance.call123testSpecialTags(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n');
@ -38,11 +38,11 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model | **modelClient** | [**ModelClient**](ModelClient.md)| client model |
### Return type ### Return type
[**Client**](Client.md) [**ModelClient**](ModelClient.md)
### Authorization ### Authorization

View File

@ -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) [[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** # **testClientModel**
> Client testClientModel(client) > ModelClient testClientModel(modelClient)
To test \"client\" model To test \"client\" model
@ -375,10 +375,10 @@ To test \"client\" model
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
final api_instance = FakeApi(); final api_instance = FakeApi();
final client = Client(); // Client | client model final modelClient = ModelClient(); // ModelClient | client model
try { try {
final result = api_instance.testClientModel(client); final result = api_instance.testClientModel(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling FakeApi->testClientModel: $e\n'); print('Exception when calling FakeApi->testClientModel: $e\n');
@ -389,11 +389,11 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model | **modelClient** | [**ModelClient**](ModelClient.md)| client model |
### Return type ### Return type
[**Client**](Client.md) [**ModelClient**](ModelClient.md)
### Authorization ### Authorization

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
# **testClassname** # **testClassname**
> Client testClassname(client) > ModelClient testClassname(modelClient)
To test class name in snake case To test class name in snake case
@ -28,10 +28,10 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key_query').apiKeyPrefix = 'Bearer'; //defaultApiClient.getAuthentication<ApiKeyAuth>('api_key_query').apiKeyPrefix = 'Bearer';
final api_instance = FakeClassnameTags123Api(); final api_instance = FakeClassnameTags123Api();
final client = Client(); // Client | client model final modelClient = ModelClient(); // ModelClient | client model
try { try {
final result = api_instance.testClassname(client); final result = api_instance.testClassname(modelClient);
print(result); print(result);
} catch (e) { } catch (e) {
print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n');
@ -42,11 +42,11 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**client** | [**Client**](Client.md)| client model | **modelClient** | [**ModelClient**](ModelClient.md)| client model |
### Return type ### Return type
[**Client**](Client.md) [**ModelClient**](ModelClient.md)
### Authorization ### Authorization

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**file** | [**MultipartFile**](MultipartFile.md) | | [optional] **file** | [**ModelFile**](ModelFile.md) | | [optional]
**files** | [**List<MultipartFile>**](MultipartFile.md) | | [optional] [default to const []] **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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -17,7 +17,7 @@ Name | Type | Description | Notes
**decimal** | **double** | | [optional] **decimal** | **double** | | [optional]
**string** | **String** | | [optional] **string** | **String** | | [optional]
**byte** | **String** | | **byte** | **String** | |
**binary** | [**MultipartFile**](File.md) | | [optional] **binary** | [**MultipartFile**](MultipartFile.md) | | [optional]
**date** | [**DateTime**](DateTime.md) | | **date** | [**DateTime**](DateTime.md) | |
**dateTime** | [**DateTime**](DateTime.md) | | [optional] **dateTime** | [**DateTime**](DateTime.md) | | [optional]
**uuid** | **String** | | [optional] **uuid** | **String** | | [optional]

View File

@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**additionalMetadata** | **String** | Additional data to pass to server | [optional] **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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -17,7 +17,7 @@ Name | Type | Description | Notes
**string** | **String** | None | [optional] **string** | **String** | None | [optional]
**patternWithoutDelimiter** | **String** | None | **patternWithoutDelimiter** | **String** | None |
**byte** | **String** | None | **byte** | **String** | None |
**binary** | [**MultipartFile**](File.md) | None | [optional] **binary** | [**MultipartFile**](MultipartFile.md) | None | [optional]
**date** | [**DateTime**](DateTime.md) | None | [optional] **date** | [**DateTime**](DateTime.md) | None | [optional]
**dateTime** | [**DateTime**](DateTime.md) | None | [optional] **dateTime** | [**DateTime**](DateTime.md) | None | [optional]
**password** | **String** | None | [optional] **password** | **String** | None | [optional]

View File

@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**additionalMetadata** | **String** | Additional data to pass to server | [optional] **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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,4 +1,4 @@
# openapi.model.Client # openapi.model.ModelClient
## Load the model package ## Load the model package
```dart ```dart

View File

@ -1,4 +1,4 @@
# openapi.model.File # openapi.model.ModelFile
## Load the model package ## Load the model package
```dart ```dart

View File

@ -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)

View File

@ -45,13 +45,11 @@ part 'model/cat.dart';
part 'model/cat_all_of.dart'; part 'model/cat_all_of.dart';
part 'model/category.dart'; part 'model/category.dart';
part 'model/class_model.dart'; part 'model/class_model.dart';
part 'model/client.dart';
part 'model/dog.dart'; part 'model/dog.dart';
part 'model/dog_all_of.dart'; part 'model/dog_all_of.dart';
part 'model/enum_arrays.dart'; part 'model/enum_arrays.dart';
part 'model/enum_class.dart'; part 'model/enum_class.dart';
part 'model/enum_test.dart'; part 'model/enum_test.dart';
part 'model/file.dart';
part 'model/file_schema_test_class.dart'; part 'model/file_schema_test_class.dart';
part 'model/foo.dart'; part 'model/foo.dart';
part 'model/format_test.dart'; part 'model/format_test.dart';
@ -67,6 +65,9 @@ part 'model/inline_response_default.dart';
part 'model/map_test.dart'; part 'model/map_test.dart';
part 'model/mixed_properties_and_additional_properties_class.dart'; part 'model/mixed_properties_and_additional_properties_class.dart';
part 'model/model200_response.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/model_return.dart';
part 'model/name.dart'; part 'model/name.dart';
part 'model/nullable_class.dart'; part 'model/nullable_class.dart';

View File

@ -23,17 +23,17 @@ class AnotherFakeApi {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [Client] client (required): /// * [ModelClient] modelClient (required):
/// client model /// client model
Future<Response> call123testSpecialTagsWithHttpInfo(Client client) async { Future<Response> call123testSpecialTagsWithHttpInfo(ModelClient modelClient) async {
// Verify required params are set. // Verify required params are set.
if (client == null) { if (modelClient == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
} }
final path = '/another-fake/dummy'.replaceAll('{format}', 'json'); final path = '/another-fake/dummy'.replaceAll('{format}', 'json');
Object postBody = client; Object postBody = modelClient;
final queryParams = <QueryParam>[]; final queryParams = <QueryParam>[];
final headerParams = <String, String>{}; final headerParams = <String, String>{};
@ -73,10 +73,10 @@ class AnotherFakeApi {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [Client] client (required): /// * [ModelClient] modelClient (required):
/// client model /// client model
Future<Client> call123testSpecialTags(Client client) async { Future<ModelClient> call123testSpecialTags(ModelClient modelClient) async {
final response = await call123testSpecialTagsWithHttpInfo(client); final response = await call123testSpecialTagsWithHttpInfo(modelClient);
if (response.statusCode >= HttpStatus.badRequest) { if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response)); 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" // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string. // FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) { 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; return null;
} }

View File

@ -555,17 +555,17 @@ class FakeApi {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [Client] client (required): /// * [ModelClient] modelClient (required):
/// client model /// client model
Future<Response> testClientModelWithHttpInfo(Client client) async { Future<Response> testClientModelWithHttpInfo(ModelClient modelClient) async {
// Verify required params are set. // Verify required params are set.
if (client == null) { if (modelClient == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
} }
final path = '/fake'.replaceAll('{format}', 'json'); final path = '/fake'.replaceAll('{format}', 'json');
Object postBody = client; Object postBody = modelClient;
final queryParams = <QueryParam>[]; final queryParams = <QueryParam>[];
final headerParams = <String, String>{}; final headerParams = <String, String>{};
@ -605,10 +605,10 @@ class FakeApi {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [Client] client (required): /// * [ModelClient] modelClient (required):
/// client model /// client model
Future<Client> testClientModel(Client client) async { Future<ModelClient> testClientModel(ModelClient modelClient) async {
final response = await testClientModelWithHttpInfo(client); final response = await testClientModelWithHttpInfo(modelClient);
if (response.statusCode >= HttpStatus.badRequest) { if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response)); 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" // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string. // FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) { 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; return null;
} }

View File

@ -23,17 +23,17 @@ class FakeClassnameTags123Api {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [Client] client (required): /// * [ModelClient] modelClient (required):
/// client model /// client model
Future<Response> testClassnameWithHttpInfo(Client client) async { Future<Response> testClassnameWithHttpInfo(ModelClient modelClient) async {
// Verify required params are set. // Verify required params are set.
if (client == null) { if (modelClient == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: client'); throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient');
} }
final path = '/fake_classname_test'.replaceAll('{format}', 'json'); final path = '/fake_classname_test'.replaceAll('{format}', 'json');
Object postBody = client; Object postBody = modelClient;
final queryParams = <QueryParam>[]; final queryParams = <QueryParam>[];
final headerParams = <String, String>{}; final headerParams = <String, String>{};
@ -73,10 +73,10 @@ class FakeClassnameTags123Api {
/// ///
/// Parameters: /// Parameters:
/// ///
/// * [Client] client (required): /// * [ModelClient] modelClient (required):
/// client model /// client model
Future<Client> testClassname(Client client) async { Future<ModelClient> testClassname(ModelClient modelClient) async {
final response = await testClassnameWithHttpInfo(client); final response = await testClassnameWithHttpInfo(modelClient);
if (response.statusCode >= HttpStatus.badRequest) { if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response)); 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" // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string. // FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) { 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; return null;
} }

View File

@ -186,8 +186,6 @@ class ApiClient {
return Category.fromJson(value); return Category.fromJson(value);
case 'ClassModel': case 'ClassModel':
return ClassModel.fromJson(value); return ClassModel.fromJson(value);
case 'Client':
return Client.fromJson(value);
case 'Dog': case 'Dog':
return Dog.fromJson(value); return Dog.fromJson(value);
case 'DogAllOf': case 'DogAllOf':
@ -198,8 +196,6 @@ class ApiClient {
return EnumClassTypeTransformer().decode(value); return EnumClassTypeTransformer().decode(value);
case 'EnumTest': case 'EnumTest':
return EnumTest.fromJson(value); return EnumTest.fromJson(value);
case 'File':
return File.fromJson(value);
case 'FileSchemaTestClass': case 'FileSchemaTestClass':
return FileSchemaTestClass.fromJson(value); return FileSchemaTestClass.fromJson(value);
case 'Foo': case 'Foo':
@ -230,6 +226,12 @@ class ApiClient {
return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value); return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value);
case 'Model200Response': case 'Model200Response':
return Model200Response.fromJson(value); return Model200Response.fromJson(value);
case 'ModelClient':
return ModelClient.fromJson(value);
case 'ModelFile':
return ModelFile.fromJson(value);
case 'ModelList':
return ModelList.fromJson(value);
case 'ModelReturn': case 'ModelReturn':
return ModelReturn.fromJson(value); return ModelReturn.fromJson(value);
case 'Name': case 'Name':

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -16,9 +16,9 @@ class FileSchemaTestClass {
this.files = const [], this.files = const [],
}); });
MultipartFile file; ModelFile file;
List<MultipartFile> files; List<ModelFile> files;
@override @override
bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && 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 static FileSchemaTestClass fromJson(Map<String, dynamic> json) => json == null
? null ? null
: FileSchemaTestClass( : FileSchemaTestClass(
file: MultipartFile.fromJson(json[r'file']), file: ModelFile.fromJson(json[r'file']),
files: MultipartFile.listFromJson(json[r'files']), files: ModelFile.listFromJson(json[r'files']),
); );
static List<FileSchemaTestClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) => static List<FileSchemaTestClass> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -1,11 +1,11 @@
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
// tests for Client // tests for ModelClient
void main() { void main() {
final instance = Client(); final instance = ModelClient();
group('test Client', () { group('test ModelClient', () {
// String client // String client
test('to test the property `client`', () async { test('to test the property `client`', () async {
// TODO // TODO

View File

@ -1,11 +1,11 @@
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
// tests for File // tests for ModelFile
void main() { void main() {
final instance = File(); final instance = ModelFile();
group('test File', () { group('test ModelFile', () {
// Test capitalization // Test capitalization
// String sourceURI // String sourceURI
test('to test the property `sourceURI`', () async { test('to test the property `sourceURI`', () async {

View File

@ -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
});
});
}