[Dart] Fix enum generation (#6729)

* [Dart] Fix enum generation

* Update generated Order file

* Re-add constructor

* Generate dart2 files

* Dart - nicer enum formatting

* Dart - generate enum name as className+enumName

* Dart - dont initialize vars to null by default

Fixes #3633

* Dart - Generate inlined enums and deserialize them

* Merge branch 'master' of github.com:agilob/openapi-generator into 6727

* Dart - Fix using default value

* Fix typo

* Regenerate add dart files

* dart Revert override for dart dio and jaguar

* Fix dart model tests

* Fix dart1 generated template

* Use {{{datatypeWithEnum}}}

* Dart - throw when enum not known

* Fix generating enum with datatype from list
This commit is contained in:
agilob 2020-07-23 04:26:25 +01:00 committed by GitHub
parent d6549f78b4
commit 90d8c32906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 597 additions and 382 deletions

View File

@ -1768,7 +1768,7 @@ public class DefaultCodegen implements CodegenConfig {
if (encoding != null) { if (encoding != null) {
codegenParameter.contentType = encoding.getContentType(); codegenParameter.contentType = encoding.getContentType();
} else { } else {
LOGGER.debug("encoding not specified for " + codegenParameter.baseName); LOGGER.debug("encoding not specified for {}", codegenParameter.baseName);
} }
} }
} }
@ -1790,6 +1790,9 @@ public class DefaultCodegen implements CodegenConfig {
/** /**
* Return the default value of the property * Return the default value of the property
* *
* Return null if you do NOT want a default value.
* Any non-null value will cause {{#defaultValue} check to pass.
*
* @param schema Property schema * @param schema Property schema
* @return string presentation of the default value of the property * @return string presentation of the default value of the property
*/ */
@ -1810,7 +1813,7 @@ public class DefaultCodegen implements CodegenConfig {
*/ */
@SuppressWarnings("squid:S3923") @SuppressWarnings("squid:S3923")
private String getPropertyDefaultValue(Schema schema) { private String getPropertyDefaultValue(Schema schema) {
/** /*
* Although all branches return null, this is left intentionally as examples for new contributors * Although all branches return null, this is left intentionally as examples for new contributors
*/ */
if (ModelUtils.isBooleanSchema(schema)) { if (ModelUtils.isBooleanSchema(schema)) {

View File

@ -17,6 +17,7 @@
package org.openapitools.codegen.languages; package org.openapitools.codegen.languages;
import com.google.common.collect.Sets;
import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.Schema;
@ -30,9 +31,8 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.camelize;
@ -50,6 +50,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PUB_HOMEPAGE = "pubHomepage"; public static final String PUB_HOMEPAGE = "pubHomepage";
public static final String USE_ENUM_EXTENSION = "useEnumExtension"; public static final String USE_ENUM_EXTENSION = "useEnumExtension";
public static final String SUPPORT_DART2 = "supportDart2"; public static final String SUPPORT_DART2 = "supportDart2";
protected boolean browserClient = true; protected boolean browserClient = true;
protected String pubName = "openapi"; protected String pubName = "openapi";
protected String pubVersion = "1.0.0"; protected String pubVersion = "1.0.0";
@ -106,9 +107,11 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
modelTestTemplateFiles.put("model_test.mustache", ".dart"); modelTestTemplateFiles.put("model_test.mustache", ".dart");
apiTestTemplateFiles.put("api_test.mustache", ".dart"); apiTestTemplateFiles.put("api_test.mustache", ".dart");
List<String> reservedWordsList = new ArrayList<String>(); List<String> reservedWordsList = new ArrayList<>();
try { try {
BufferedReader reader = new BufferedReader(new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), Charset.forName("UTF-8"))); BufferedReader reader = new BufferedReader(
new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"),
StandardCharsets.UTF_8));
while (reader.ready()) { while (reader.ready()) {
reservedWordsList.add(reader.readLine()); reservedWordsList.add(reader.readLine());
} }
@ -118,18 +121,17 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
setReservedWordsLowerCase(reservedWordsList); setReservedWordsLowerCase(reservedWordsList);
languageSpecificPrimitives = new HashSet<String>( languageSpecificPrimitives = Sets.newHashSet(
Arrays.asList( "String",
"String", "bool",
"bool", "int",
"int", "num",
"num", "double"
"double")
); );
instantiationTypes.put("array", "List"); instantiationTypes.put("array", "List");
instantiationTypes.put("map", "Map"); instantiationTypes.put("map", "Map");
typeMapping = new HashMap<String, String>(); typeMapping = new HashMap<>();
typeMapping.put("Array", "List"); typeMapping.put("Array", "List");
typeMapping.put("array", "List"); typeMapping.put("array", "List");
typeMapping.put("List", "List"); typeMapping.put("List", "List");
@ -329,7 +331,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
// replace - with _ e.g. created-at => created_at // replace - with _ e.g. created-at => created_at
name = name.replaceAll("-", "_"); name = name.replaceAll("-", "_");
// if it's all uppper case, do nothing // if it's all upper case, do nothing
if (name.matches("^[A-Z_]*$")) { if (name.matches("^[A-Z_]*$")) {
return name; return name;
} }
@ -403,9 +405,9 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String toDefaultValue(Schema schema) { public String toDefaultValue(Schema schema) {
if (ModelUtils.isMapSchema(schema)) { if (ModelUtils.isMapSchema(schema)) {
return "{}"; return "const {}";
} else if (ModelUtils.isArraySchema(schema)) { } else if (ModelUtils.isArraySchema(schema)) {
return "[]"; return "const []";
} }
if (schema.getDefault() != null) { if (schema.getDefault() != null) {
@ -414,7 +416,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
return schema.getDefault().toString(); return schema.getDefault().toString();
} else { } else {
return "null"; return null;
} }
} }
@ -435,7 +437,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override @Override
public String getSchemaType(Schema p) { public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p); String openAPIType = super.getSchemaType(p);
String type = null; String type;
if (typeMapping.containsKey(openAPIType)) { if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType); type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) { if (languageSpecificPrimitives.contains(type)) {
@ -495,19 +497,16 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
return false; return false;
} }
Object extension = cm.vendorExtensions.get("x-enum-values"); Object extension = cm.vendorExtensions.get("x-enum-values");
List<Map<String, Object>> values = List<Map<String, Object>> values = (List<Map<String, Object>>) extension;
(List<Map<String, Object>>) extension; List<Map<String, String>> enumVars = new ArrayList<>();
List<Map<String, String>> enumVars =
new ArrayList<Map<String, String>>();
for (Map<String, Object> value : values) { for (Map<String, Object> value : values) {
Map<String, String> enumVar = new HashMap<String, String>(); Map<String, String> enumVar = new HashMap<>();
String name = camelize((String) value.get("identifier"), true); String name = camelize((String) value.get("identifier"), true);
if (isReservedWord(name)) { if (isReservedWord(name)) {
name = escapeReservedWord(name); name = escapeReservedWord(name);
} }
enumVar.put("name", name); enumVar.put("name", name);
enumVar.put("value", toEnumValue( enumVar.put("value", toEnumValue(value.get("numericValue").toString(), cm.dataType));
value.get("numericValue").toString(), cm.dataType));
if (value.containsKey("description")) { if (value.containsKey("description")) {
enumVar.put("description", value.get("description").toString()); enumVar.put("description", value.get("description").toString());
} }
@ -611,13 +610,12 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
} }
// only procees the following type (or we can simply rely on the file extension to check if it's a Dart file) // only procees the following type (or we can simply rely on the file extension to check if it's a Dart file)
Set<String> supportedFileType = new HashSet<String>( Set<String> supportedFileType = Sets.newHashSet(
Arrays.asList( "supporting-mustache",
"supporting-mustache", "model-test",
"model-test", "model",
"model", "api-test",
"api-test", "api");
"api"));
if (!supportedFileType.contains(fileType)) { if (!supportedFileType.contains(fileType)) {
return; return;
} }
@ -632,7 +630,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
if (exitValue != 0) { if (exitValue != 0) {
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
} else { } else {
LOGGER.info("Successfully executed: " + command); LOGGER.info("Successfully executed: {}", command);
} }
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());

View File

@ -130,13 +130,21 @@ public class DartDioClientCodegen extends DartClientCodegen {
} }
@Override @Override
public String toDefaultValue(Schema p) { public String toDefaultValue(Schema schema) {
if (ModelUtils.isMapSchema(p)) { if (ModelUtils.isMapSchema(schema)) {
return "const {}"; return "const {}";
} else if (ModelUtils.isArraySchema(p)) { } else if (ModelUtils.isArraySchema(schema)) {
return "const []"; return "const []";
} }
return super.toDefaultValue(p);
if (schema.getDefault() != null) {
if (ModelUtils.isStringSchema(schema)) {
return "\"" + schema.getDefault().toString().replaceAll("\"", "\\\"") + "\"";
}
return schema.getDefault().toString();
} else {
return "null";
}
} }
@Override @Override

View File

@ -132,13 +132,21 @@ public class DartJaguarClientCodegen extends DartClientCodegen {
} }
@Override @Override
public String toDefaultValue(Schema p) { public String toDefaultValue(Schema schema) {
if (ModelUtils.isMapSchema(p)) { if (ModelUtils.isMapSchema(schema)) {
return "const {}"; return "const {}";
} else if (ModelUtils.isArraySchema(p)) { } else if (ModelUtils.isArraySchema(schema)) {
return "const []"; return "const []";
} }
return super.toDefaultValue(p);
if (schema.getDefault() != null) {
if (ModelUtils.isStringSchema(schema)) {
return "\"" + schema.getDefault().toString().replaceAll("\"", "\\\"") + "\"";
}
return schema.getDefault().toString();
} else {
return "null";
}
} }
@Override @Override

View File

@ -1,7 +1,7 @@
class {{classname}} { class {{classname}} {
{{#vars}} {{#vars}}
{{#description}}/* {{{description}}} */{{/description}} {{#description}}/* {{{description}}} */{{/description}}
{{{dataType}}} {{name}} = {{{defaultValue}}}; {{^defaultValue}}{{{dataType}}} {{name}} = null;{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}}
{{#allowableValues}} {{#allowableValues}}
{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{
{{/allowableValues}} {{/allowableValues}}

View File

@ -1,15 +1,19 @@
class {{classname}} { class {{classname}} {
{{#vars}} {{#vars}}
{{#description}}/* {{{description}}} */{{/description}} {{#description}}/// {{{description}}}{{/description}}
{{{dataType}}} {{name}} = {{{defaultValue}}}; {{^isEnum}}
{{^defaultValue}}{{{dataType}}} {{name}};{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}}
{{/isEnum}}
{{#isEnum}}
{{#allowableValues}} {{#allowableValues}}
{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ {{#min}} // range from {{min}} to {{max}}{{/min}}{{classname}}{{{enumName}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}}{{/required}};
{{/allowableValues}} {{/allowableValues}}
{{/isEnum}}
{{/vars}} {{/vars}}
{{classname}}({ {{classname}}({
{{#vars}} {{#vars}}
{{#required}}@required this.{{name}},{{/required}}{{^required}}this.{{name}},{{/required}} {{#required}}@required this.{{name}}{{/required}}{{^required}}this.{{name}}{{#defaultValue}} = {{defaultValue}}{{/defaultValue}}{{/required}},
{{/vars}} {{/vars}}
}); });
@ -78,7 +82,12 @@ class {{classname}} {
json['{{baseName}}'].toDouble(); json['{{baseName}}'].toDouble();
{{/isDouble}} {{/isDouble}}
{{^isDouble}} {{^isDouble}}
{{^isEnum}}
{{name}} = json['{{baseName}}']; {{name}} = json['{{baseName}}'];
{{/isEnum}}
{{#isEnum}}
{{name}} = {{classname}}{{{enumName}}}.fromJson(json['{{baseName}}']);
{{/isEnum}}
{{/isDouble}} {{/isDouble}}
{{/isMapContainer}} {{/isMapContainer}}
{{/isListContainer}} {{/isListContainer}}
@ -89,7 +98,7 @@ class {{classname}} {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
{{#vars}} {{#vars}}
{{^isNullable}} {{^isNullable}}
if ({{name}} != null) if ({{name}} != null)
@ -102,7 +111,12 @@ class {{classname}} {
{{/isDate}} {{/isDate}}
{{^isDateTime}} {{^isDateTime}}
{{^isDate}} {{^isDate}}
{{^isEnum}}
json['{{baseName}}'] = {{name}}; json['{{baseName}}'] = {{name}};
{{/isEnum}}
{{#isEnum}}
json['{{baseName}}'] = {{name}}.value;
{{/isEnum}}
{{/isDate}} {{/isDate}}
{{/isDateTime}} {{/isDateTime}}
{{/vars}} {{/vars}}
@ -114,7 +128,7 @@ class {{classname}} {
} }
static Map<String, {{classname}}> mapFromJson(Map<String, dynamic> json) { static Map<String, {{classname}}> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, {{classname}}>(); final map = Map<String, {{classname}}>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = {{classname}}.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = {{classname}}.fromJson(value));
} }
@ -123,12 +137,17 @@ class {{classname}} {
// maps a json object with a list of {{classname}}-objects as value to a dart map // maps a json object with a list of {{classname}}-objects as value to a dart map
static Map<String, List<{{classname}}>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<{{classname}}>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<{{classname}}>>(); final map = Map<String, List<{{classname}}>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = {{classname}}.listFromJson(value); map[key] = {{classname}}.listFromJson(value);
}); });
} }
return map; return map;
} }
} }
{{#vars}}
{{#isEnum}}
{{>enum_inline}}
{{/isEnum}}
{{/vars}}

View File

@ -9,20 +9,27 @@ class {{classname}} {
{{#description}} {{#description}}
/// {{description}} /// {{description}}
{{/description}} {{/description}}
static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}}); static const {{classname}} {{{name}}} = {{classname}}._internal({{value}});
{{/enumVars}} {{/enumVars}}
{{/allowableValues}} {{/allowableValues}}
{{dataType}} toJson (){ {{dataType}} toJson () {
return this.value; return value;
}
@override
String toString () {
return value;
} }
static {{classname}} fromJson({{dataType}} value) { static {{classname}} fromJson({{dataType}} value) {
return new {{classname}}TypeTransformer().decode(value); return {{classname}}TypeTransformer().decode(value);
} }
static List<{{classname}}> listFromJson(List<dynamic> json) { static List<{{classname}}> listFromJson(List<dynamic> json) {
return json == null ? new List<{{classname}}>() : json.map((value) => {{classname}}.fromJson(value)).toList(); return json == null
? List<{{classname}}>()
: json.map((value) => {{classname}}.fromJson(value)).toList();
} }
} }

View File

@ -0,0 +1,52 @@
class {{classname}}{{enumName}} {
/// The underlying value of this enum member.
final {{{dataType}}} value;
const {{classname}}{{enumName}}._internal(this.value);
{{#allowableValues}}
{{#enumVars}}
{{#description}}
/// {{description}}
{{/description}}
static const {{classname}}{{enumName}} {{name}} = {{classname}}{{enumName}}._internal({{{value}}});
{{/enumVars}}
{{/allowableValues}}
{{{dataType}}} toJson () {
return value;
}
@override
String toString () {
return value;
}
static {{classname}}{{enumName}} fromJson({{{dataType}}} value) {
return {{classname}}{{enumName}}TypeTransformer().decode(value);
}
static List<{{classname}}{{enumName}}> listFromJson(List<dynamic> json) {
return json == null
? List<{{classname}}{{enumName}}>()
: json.map((value) => {{classname}}{{enumName}}.fromJson(value)).toList();
}
}
class {{classname}}{{enumName}}TypeTransformer {
dynamic encode({{classname}}{{enumName}} data) {
return data.value;
}
{{classname}}{{enumName}} decode(dynamic data) {
switch (data) {
{{#allowableValues}}
{{#enumVars}}
case {{{value}}}: return {{classname}}{{enumName}}.{{{name}}};
{{/enumVars}}
{{/allowableValues}}
default: return null;
}
}
}

View File

@ -36,6 +36,7 @@ public class DartModelTest {
.addProperties("id", new IntegerSchema()) .addProperties("id", new IntegerSchema())
.addProperties("name", new StringSchema()) .addProperties("name", new StringSchema())
.addProperties("createdAt", new DateTimeSchema()) .addProperties("createdAt", new DateTimeSchema())
.addProperties("defaultItem", new IntegerSchema()._default(1))
.addRequiredItem("id") .addRequiredItem("id")
.addRequiredItem("name"); .addRequiredItem("name");
final DefaultCodegen codegen = new DartClientCodegen(); final DefaultCodegen codegen = new DartClientCodegen();
@ -46,7 +47,7 @@ public class DartModelTest {
Assert.assertEquals(cm.name, "sample"); Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model"); Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 3); Assert.assertEquals(cm.vars.size(), 4);
// {{imports}} is not used in template // {{imports}} is not used in template
//Assert.assertEquals(cm.imports.size(), 1); //Assert.assertEquals(cm.imports.size(), 1);
@ -54,7 +55,7 @@ public class DartModelTest {
Assert.assertEquals(property1.baseName, "id"); Assert.assertEquals(property1.baseName, "id");
Assert.assertEquals(property1.dataType, "int"); Assert.assertEquals(property1.dataType, "int");
Assert.assertEquals(property1.name, "id"); Assert.assertEquals(property1.name, "id");
Assert.assertEquals(property1.defaultValue, "null"); Assert.assertNull(property1.defaultValue);
Assert.assertEquals(property1.baseType, "int"); Assert.assertEquals(property1.baseType, "int");
Assert.assertTrue(property1.hasMore); Assert.assertTrue(property1.hasMore);
Assert.assertTrue(property1.required); Assert.assertTrue(property1.required);
@ -65,7 +66,7 @@ public class DartModelTest {
Assert.assertEquals(property2.baseName, "name"); Assert.assertEquals(property2.baseName, "name");
Assert.assertEquals(property2.dataType, "String"); Assert.assertEquals(property2.dataType, "String");
Assert.assertEquals(property2.name, "name"); Assert.assertEquals(property2.name, "name");
Assert.assertEquals(property2.defaultValue, "null"); Assert.assertNull(property2.defaultValue);
Assert.assertEquals(property2.baseType, "String"); Assert.assertEquals(property2.baseType, "String");
Assert.assertTrue(property2.hasMore); Assert.assertTrue(property2.hasMore);
Assert.assertTrue(property2.required); Assert.assertTrue(property2.required);
@ -77,11 +78,20 @@ public class DartModelTest {
Assert.assertEquals(property3.complexType, "DateTime"); Assert.assertEquals(property3.complexType, "DateTime");
Assert.assertEquals(property3.dataType, "DateTime"); Assert.assertEquals(property3.dataType, "DateTime");
Assert.assertEquals(property3.name, "createdAt"); Assert.assertEquals(property3.name, "createdAt");
Assert.assertEquals(property3.defaultValue, "null"); Assert.assertNull(property3.defaultValue);
Assert.assertEquals(property3.baseType, "DateTime"); Assert.assertEquals(property3.baseType, "DateTime");
Assert.assertFalse(property3.hasMore); Assert.assertTrue(property3.hasMore);
Assert.assertFalse(property3.required); Assert.assertFalse(property3.required);
Assert.assertFalse(property3.isContainer); Assert.assertFalse(property3.isContainer);
final CodegenProperty property4 = cm.vars.get(3);
Assert.assertEquals(property4.baseName, "defaultItem");
Assert.assertEquals(property4.dataType, "int");
Assert.assertEquals(property4.defaultValue, "1");
Assert.assertEquals(property4.baseType, "int");
Assert.assertFalse(property4.hasMore);
Assert.assertFalse(property4.required);
Assert.assertFalse(property4.isContainer);
} }
@Test(description = "convert a model with list property") @Test(description = "convert a model with list property")
@ -89,9 +99,9 @@ public class DartModelTest {
final Schema model = new Schema() final Schema model = new Schema()
.description("a sample model") .description("a sample model")
.addProperties("id", new IntegerSchema()) .addProperties("id", new IntegerSchema())
.addProperties("urls", new ArraySchema() .addProperties("urls", new ArraySchema().items(new StringSchema()))
.items(new StringSchema()))
.addRequiredItem("id"); .addRequiredItem("id");
final DefaultCodegen codegen = new DartClientCodegen(); final DefaultCodegen codegen = new DartClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI); codegen.setOpenAPI(openAPI);
@ -106,7 +116,7 @@ public class DartModelTest {
Assert.assertEquals(property1.baseName, "id"); Assert.assertEquals(property1.baseName, "id");
Assert.assertEquals(property1.dataType, "int"); Assert.assertEquals(property1.dataType, "int");
Assert.assertEquals(property1.name, "id"); Assert.assertEquals(property1.name, "id");
Assert.assertEquals(property1.defaultValue, "null"); Assert.assertNull(property1.defaultValue);
Assert.assertEquals(property1.baseType, "int"); Assert.assertEquals(property1.baseType, "int");
Assert.assertTrue(property1.hasMore); Assert.assertTrue(property1.hasMore);
Assert.assertTrue(property1.required); Assert.assertTrue(property1.required);

View File

@ -8,9 +8,9 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**code** | **int** | | [optional] [default to null] **code** | **int** | | [optional]
**type** | **String** | | [optional] [default to null] **type** | **String** | | [optional]
**message** | **String** | | [optional] [default to null] **message** | **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) [[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

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**name** | **String** | Updated name of the pet | [optional] [default to null] **name** | **String** | Updated name of the pet | [optional]
**status** | **String** | Updated status of the pet | [optional] [default to null] **status** | **String** | Updated status of the pet | [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

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**additionalMetadata** | **String** | Additional data to pass to server | [optional] [default to null] **additionalMetadata** | **String** | Additional data to pass to server | [optional]
**file** | [**MultipartFile**](File.md) | file to upload | [optional] [default to null] **file** | [**MultipartFile**](File.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

@ -8,11 +8,11 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**petId** | **int** | | [optional] [default to null] **petId** | **int** | | [optional]
**quantity** | **int** | | [optional] [default to null] **quantity** | **int** | | [optional]
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] **shipDate** | [**DateTime**](DateTime.md) | | [optional]
**status** | **String** | Order Status | [optional] [default to null] **status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false] **complete** | **bool** | | [optional] [default to false]
[[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

@ -8,12 +8,12 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional] [default to null] **category** | [**Category**](Category.md) | | [optional]
**name** | **String** | | [default to null] **name** | **String** | |
**photoUrls** | **List&lt;String&gt;** | | [default to []] **photoUrls** | **List&lt;String&gt;** | | [default to const []]
**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to []] **tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null] **status** | **String** | pet status in the store | [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

@ -88,8 +88,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| Pet id to delete | [default to null] **petId** | **int**| Pet id to delete |
**apiKey** | **String**| | [optional] [default to null] **apiKey** | **String**| | [optional]
### Return type ### Return type
@ -134,7 +134,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to []] **status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type ### Return type
@ -179,7 +179,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to []] **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
### Return type ### Return type
@ -226,7 +226,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to return | [default to null] **petId** | **int**| ID of pet to return |
### Return type ### Return type
@ -313,9 +313,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet that needs to be updated | [default to null] **petId** | **int**| ID of pet that needs to be updated |
**name** | **String**| Updated name of the pet | [optional] [default to null] **name** | **String**| Updated name of the pet | [optional]
**status** | **String**| Updated status of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional]
### Return type ### Return type
@ -360,9 +360,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to update | [default to null] **petId** | **int**| ID of pet to update |
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional]
**file** | **MultipartFile**| file to upload | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional]
### Return type ### Return type

View File

@ -40,7 +40,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of the order that needs to be deleted | [default to null] **orderId** | **String**| ID of the order that needs to be deleted |
### Return type ### Return type
@ -126,7 +126,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **int**| ID of pet that needs to be fetched | [default to null] **orderId** | **int**| ID of pet that needs to be fetched |
### Return type ### Return type

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,14 +8,14 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**username** | **String** | | [optional] [default to null] **username** | **String** | | [optional]
**firstName** | **String** | | [optional] [default to null] **firstName** | **String** | | [optional]
**lastName** | **String** | | [optional] [default to null] **lastName** | **String** | | [optional]
**email** | **String** | | [optional] [default to null] **email** | **String** | | [optional]
**password** | **String** | | [optional] [default to null] **password** | **String** | | [optional]
**phone** | **String** | | [optional] [default to null] **phone** | **String** | | [optional]
**userStatus** | **int** | User Status | [optional] [default to null] **userStatus** | **int** | User Status | [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

@ -182,7 +182,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be deleted | [default to null] **username** | **String**| The name that needs to be deleted |
### Return type ### Return type
@ -223,7 +223,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type
@ -265,8 +265,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login | [default to null] **username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text | [default to null] **password** | **String**| The password for login in clear text |
### Return type ### Return type
@ -353,7 +353,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted | [default to null] **username** | **String**| name that need to be deleted |
**user** | [**User**](User.md)| Updated user object | **user** | [**User**](User.md)| Updated user object |
### Return type ### Return type

View File

@ -8,9 +8,9 @@ class Pet {
String name = null; String name = null;
List<String> photoUrls = []; List<String> photoUrls = const [];
List<Tag> tags = []; List<Tag> tags = const [];
/* pet status in the store */ /* pet status in the store */
String status = null; String status = null;
//enum statusEnum { available, pending, sold, };{ //enum statusEnum { available, pending, sold, };{

View File

@ -8,9 +8,9 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**code** | **int** | | [optional] [default to null] **code** | **int** | | [optional]
**type** | **String** | | [optional] [default to null] **type** | **String** | | [optional]
**message** | **String** | | [optional] [default to null] **message** | **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) [[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

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,11 +8,11 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**petId** | **int** | | [optional] [default to null] **petId** | **int** | | [optional]
**quantity** | **int** | | [optional] [default to null] **quantity** | **int** | | [optional]
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] **shipDate** | [**DateTime**](DateTime.md) | | [optional]
**status** | **String** | Order Status | [optional] [default to null] **status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false] **complete** | **bool** | | [optional] [default to false]
[[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

@ -8,12 +8,12 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional] [default to null] **category** | [**Category**](Category.md) | | [optional]
**name** | **String** | | [default to null] **name** | **String** | |
**photoUrls** | **List&lt;String&gt;** | | [default to []] **photoUrls** | **List&lt;String&gt;** | | [default to const []]
**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to []] **tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null] **status** | **String** | pet status in the store | [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

@ -87,8 +87,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| Pet id to delete | [default to null] **petId** | **int**| Pet id to delete |
**apiKey** | **String**| | [optional] [default to null] **apiKey** | **String**| | [optional]
### Return type ### Return type
@ -133,7 +133,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to []] **status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type ### Return type
@ -178,7 +178,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to []] **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
### Return type ### Return type
@ -225,7 +225,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to return | [default to null] **petId** | **int**| ID of pet to return |
### Return type ### Return type
@ -311,9 +311,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet that needs to be updated | [default to null] **petId** | **int**| ID of pet that needs to be updated |
**name** | **String**| Updated name of the pet | [optional] [default to null] **name** | **String**| Updated name of the pet | [optional]
**status** | **String**| Updated status of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional]
### Return type ### Return type
@ -358,9 +358,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to update | [default to null] **petId** | **int**| ID of pet to update |
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional]
**file** | **MultipartFile**| file to upload | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional]
### Return type ### Return type

View File

@ -40,7 +40,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of the order that needs to be deleted | [default to null] **orderId** | **String**| ID of the order that needs to be deleted |
### Return type ### Return type
@ -126,7 +126,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **int**| ID of pet that needs to be fetched | [default to null] **orderId** | **int**| ID of pet that needs to be fetched |
### Return type ### Return type

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,14 +8,14 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**username** | **String** | | [optional] [default to null] **username** | **String** | | [optional]
**firstName** | **String** | | [optional] [default to null] **firstName** | **String** | | [optional]
**lastName** | **String** | | [optional] [default to null] **lastName** | **String** | | [optional]
**email** | **String** | | [optional] [default to null] **email** | **String** | | [optional]
**password** | **String** | | [optional] [default to null] **password** | **String** | | [optional]
**phone** | **String** | | [optional] [default to null] **phone** | **String** | | [optional]
**userStatus** | **int** | User Status | [optional] [default to null] **userStatus** | **int** | User Status | [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

@ -166,7 +166,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be deleted | [default to null] **username** | **String**| The name that needs to be deleted |
### Return type ### Return type
@ -207,7 +207,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type
@ -249,8 +249,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login | [default to null] **username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text | [default to null] **password** | **String**| The password for login in clear text |
### Return type ### Return type
@ -329,7 +329,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted | [default to null] **username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object | **body** | [**User**](User.md)| Updated user object |
### Return type ### Return type

View File

@ -8,9 +8,9 @@ class Pet {
String name = null; String name = null;
List<String> photoUrls = []; List<String> photoUrls = const [];
List<Tag> tags = []; List<Tag> tags = const [];
/* pet status in the store */ /* pet status in the store */
String status = null; String status = null;
//enum statusEnum { available, pending, sold, };{ //enum statusEnum { available, pending, sold, };{

View File

@ -8,9 +8,9 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**code** | **int** | | [optional] [default to null] **code** | **int** | | [optional]
**type** | **String** | | [optional] [default to null] **type** | **String** | | [optional]
**message** | **String** | | [optional] [default to null] **message** | **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) [[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

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,11 +8,11 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**petId** | **int** | | [optional] [default to null] **petId** | **int** | | [optional]
**quantity** | **int** | | [optional] [default to null] **quantity** | **int** | | [optional]
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] **shipDate** | [**DateTime**](DateTime.md) | | [optional]
**status** | **String** | Order Status | [optional] [default to null] **status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false] **complete** | **bool** | | [optional] [default to false]
[[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

@ -8,12 +8,12 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional] [default to null] **category** | [**Category**](Category.md) | | [optional]
**name** | **String** | | [default to null] **name** | **String** | |
**photoUrls** | **List&lt;String&gt;** | | [default to []] **photoUrls** | **List&lt;String&gt;** | | [default to const []]
**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to []] **tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null] **status** | **String** | pet status in the store | [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

@ -87,8 +87,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| Pet id to delete | [default to null] **petId** | **int**| Pet id to delete |
**apiKey** | **String**| | [optional] [default to null] **apiKey** | **String**| | [optional]
### Return type ### Return type
@ -133,7 +133,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to []] **status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type ### Return type
@ -178,7 +178,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to []] **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
### Return type ### Return type
@ -225,7 +225,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to return | [default to null] **petId** | **int**| ID of pet to return |
### Return type ### Return type
@ -311,9 +311,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet that needs to be updated | [default to null] **petId** | **int**| ID of pet that needs to be updated |
**name** | **String**| Updated name of the pet | [optional] [default to null] **name** | **String**| Updated name of the pet | [optional]
**status** | **String**| Updated status of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional]
### Return type ### Return type
@ -358,9 +358,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to update | [default to null] **petId** | **int**| ID of pet to update |
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional]
**file** | **MultipartFile**| file to upload | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional]
### Return type ### Return type

View File

@ -40,7 +40,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of the order that needs to be deleted | [default to null] **orderId** | **String**| ID of the order that needs to be deleted |
### Return type ### Return type
@ -126,7 +126,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **int**| ID of pet that needs to be fetched | [default to null] **orderId** | **int**| ID of pet that needs to be fetched |
### Return type ### Return type

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,14 +8,14 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**username** | **String** | | [optional] [default to null] **username** | **String** | | [optional]
**firstName** | **String** | | [optional] [default to null] **firstName** | **String** | | [optional]
**lastName** | **String** | | [optional] [default to null] **lastName** | **String** | | [optional]
**email** | **String** | | [optional] [default to null] **email** | **String** | | [optional]
**password** | **String** | | [optional] [default to null] **password** | **String** | | [optional]
**phone** | **String** | | [optional] [default to null] **phone** | **String** | | [optional]
**userStatus** | **int** | User Status | [optional] [default to null] **userStatus** | **int** | User Status | [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

@ -166,7 +166,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be deleted | [default to null] **username** | **String**| The name that needs to be deleted |
### Return type ### Return type
@ -207,7 +207,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type
@ -249,8 +249,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login | [default to null] **username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text | [default to null] **password** | **String**| The password for login in clear text |
### Return type ### Return type
@ -329,7 +329,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted | [default to null] **username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object | **body** | [**User**](User.md)| Updated user object |
### Return type ### Return type

View File

@ -8,9 +8,9 @@ class Pet {
String name = null; String name = null;
List<String> photoUrls = []; List<String> photoUrls = const [];
List<Tag> tags = []; List<Tag> tags = const [];
/* pet status in the store */ /* pet status in the store */
String status = null; String status = null;
//enum statusEnum { available, pending, sold, };{ //enum statusEnum { available, pending, sold, };{

View File

@ -9,12 +9,10 @@ class Order {
int quantity = null; int quantity = null;
DateTime shipDate = null; DateTime shipDate = null;
/* Order Status */ /// Order Status
String status = null; StatusEnum status = null;
//enum statusEnum { placed, approved, delivered, };{
bool complete = false; bool complete = false;
Order();
@override @override
String toString() { String toString() {
@ -65,12 +63,14 @@ class Order {
// maps a json object with a list of Order-objects as value to a dart map // maps a json object with a list of Order-objects as value to a dart map
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Order>>(); var map = Map<String, List<Order>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Order.listFromJson(value); map[key] = Order.listFromJson(value);
}); });
} }
return map; return map;
} }
} }
enum StatusEnum { placed, approved, delivered, }

View File

@ -11,10 +11,8 @@ class Pet {
List<String> photoUrls = []; List<String> photoUrls = [];
List<Tag> tags = []; List<Tag> tags = [];
/* pet status in the store */ /// pet status in the store
String status = null; StatusEnum status = null;
//enum statusEnum { available, pending, sold, };{
Pet();
@override @override
String toString() { String toString() {
@ -69,12 +67,14 @@ class Pet {
// maps a json object with a list of Pet-objects as value to a dart map // maps a json object with a list of Pet-objects as value to a dart map
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Pet>>(); var map = Map<String, List<Pet>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Pet.listFromJson(value); map[key] = Pet.listFromJson(value);
}); });
} }
return map; return map;
} }
} }
enum StatusEnum { available, pending, sold, }

View File

@ -5,7 +5,6 @@ class Tag {
int id = null; int id = null;
String name = null; String name = null;
Tag();
@override @override
String toString() { String toString() {
@ -42,12 +41,11 @@ class Tag {
// maps a json object with a list of Tag-objects as value to a dart map // maps a json object with a list of Tag-objects as value to a dart map
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Tag>>(); var map = Map<String, List<Tag>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Tag.listFromJson(value); map[key] = Tag.listFromJson(value);
}); });
} }
return map; return map;
} }
} }

View File

@ -0,0 +1,9 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
void main() {
test('Check if default value is generated', () async {
var order = Order();
expect(order.complete, equals(false));
});
}

View File

@ -1,4 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'dart:math';
import 'package:http/http.dart'; import 'package:http/http.dart';
import 'package:openapi/api.dart'; import 'package:openapi/api.dart';
@ -31,7 +32,7 @@ void main() {
..category = category ..category = category
..tags = tags ..tags = tags
..name = name ..name = name
..status = status ..status = PetStatusEnum.fromJson(status)
..photoUrls = ['https://petstore.com/sample/photo1.jpg']; ..photoUrls = ['https://petstore.com/sample/photo1.jpg'];
} }
@ -188,10 +189,10 @@ void main() {
final id1 = newId(); final id1 = newId();
final id2 = newId(); final id2 = newId();
final id3 = newId(); final id3 = newId();
final status = 'available'; final status = PetStatusEnum.available_.value;
final pet1 = makePet(id: id1, status: status); final pet1 = makePet(id: id1, status: status);
final pet2 = makePet(id: id2, status: status); final pet2 = makePet(id: id2, status: status);
final pet3 = makePet(id: id3, status: 'sold'); final pet3 = makePet(id: id3, status: PetStatusEnum.sold_.value);
return Future.wait([addPet(pet1), addPet(pet2), addPet(pet3)]) return Future.wait([addPet(pet1), addPet(pet2), addPet(pet3)])
.then((_) async { .then((_) async {
@ -202,6 +203,10 @@ void main() {
getResponseBody: petApi.apiClient.serialize([pet1, pet2]), getResponseBody: petApi.apiClient.serialize([pet1, pet2]),
); );
final pets = await petApi.findPetsByStatus([status]); final pets = await petApi.findPetsByStatus([status]);
// tests serialisation and deserialisation of enum
final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available_);
expect(petsByStatus.length, equals(2));
final petIds = pets.map((pet) => pet.id).toList(); final petIds = pets.map((pet) => pet.id).toList();
expect(petIds, contains(id1)); expect(petIds, contains(id1));
expect(petIds, contains(id2)); expect(petIds, contains(id2));

View File

@ -25,14 +25,16 @@ void main() {
..id = 124321 ..id = 124321
..name = 'Jose' ..name = 'Jose'
]; ];
return Pet( return Pet(
id : id, id : id,
category: category, category: category,
name: name, //required field name: name, //required field
tags: tags,
photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field
) )
..tags = tags ..status = PetStatusEnum.fromJson(status)
..status = ''; ..photoUrls = ['https://petstore.com/sample/photo1.jpg'];
} }
group('Pet API with live client', () { group('Pet API with live client', () {
@ -79,12 +81,12 @@ void main() {
var id1 = newId(); var id1 = newId();
var id2 = newId(); var id2 = newId();
var id3 = newId(); var id3 = newId();
var status = 'available'; var status = PetStatusEnum.available_.value;
return Future.wait([ return Future.wait([
petApi.addPet(makePet(id: id1, status: status)), petApi.addPet(makePet(id: id1, status: status)),
petApi.addPet(makePet(id: id2, status: status)), petApi.addPet(makePet(id: id2, status: status)),
petApi.addPet(makePet(id: id3, status: 'sold')) petApi.addPet(makePet(id: id3, status: PetStatusEnum.sold_.value))
]).then((_) async { ]).then((_) async {
var pets = await petApi.findPetsByStatus([status]); var pets = await petApi.findPetsByStatus([status]);
var petIds = pets.map((pet) => pet.id).toList(); var petIds = pets.map((pet) => pet.id).toList();

View File

@ -8,9 +8,9 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**code** | **int** | | [optional] [default to null] **code** | **int** | | [optional]
**type** | **String** | | [optional] [default to null] **type** | **String** | | [optional]
**message** | **String** | | [optional] [default to null] **message** | **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) [[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

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,11 +8,11 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**petId** | **int** | | [optional] [default to null] **petId** | **int** | | [optional]
**quantity** | **int** | | [optional] [default to null] **quantity** | **int** | | [optional]
**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] **shipDate** | [**DateTime**](DateTime.md) | | [optional]
**status** | **String** | Order Status | [optional] [default to null] **status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false] **complete** | **bool** | | [optional] [default to false]
[[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

@ -8,12 +8,12 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**category** | [**Category**](Category.md) | | [optional] [default to null] **category** | [**Category**](Category.md) | | [optional]
**name** | **String** | | [default to null] **name** | **String** | |
**photoUrls** | **List&lt;String&gt;** | | [default to []] **photoUrls** | **List&lt;String&gt;** | | [default to const []]
**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to []] **tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to const []]
**status** | **String** | pet status in the store | [optional] [default to null] **status** | **String** | pet status in the store | [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

@ -87,8 +87,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| Pet id to delete | [default to null] **petId** | **int**| Pet id to delete |
**apiKey** | **String**| | [optional] [default to null] **apiKey** | **String**| | [optional]
### Return type ### Return type
@ -133,7 +133,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to []] **status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
### Return type ### Return type
@ -178,7 +178,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to []] **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
### Return type ### Return type
@ -225,7 +225,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to return | [default to null] **petId** | **int**| ID of pet to return |
### Return type ### Return type
@ -311,9 +311,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet that needs to be updated | [default to null] **petId** | **int**| ID of pet that needs to be updated |
**name** | **String**| Updated name of the pet | [optional] [default to null] **name** | **String**| Updated name of the pet | [optional]
**status** | **String**| Updated status of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional]
### Return type ### Return type
@ -358,9 +358,9 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**petId** | **int**| ID of pet to update | [default to null] **petId** | **int**| ID of pet to update |
**additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional]
**file** | **MultipartFile**| file to upload | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional]
### Return type ### Return type

View File

@ -40,7 +40,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **String**| ID of the order that needs to be deleted | [default to null] **orderId** | **String**| ID of the order that needs to be deleted |
### Return type ### Return type
@ -126,7 +126,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**orderId** | **int**| ID of pet that needs to be fetched | [default to null] **orderId** | **int**| ID of pet that needs to be fetched |
### Return type ### Return type

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**name** | **String** | | [optional] [default to null] **name** | **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) [[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

@ -8,14 +8,14 @@ import 'package:openapi/api.dart';
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional] [default to null] **id** | **int** | | [optional]
**username** | **String** | | [optional] [default to null] **username** | **String** | | [optional]
**firstName** | **String** | | [optional] [default to null] **firstName** | **String** | | [optional]
**lastName** | **String** | | [optional] [default to null] **lastName** | **String** | | [optional]
**email** | **String** | | [optional] [default to null] **email** | **String** | | [optional]
**password** | **String** | | [optional] [default to null] **password** | **String** | | [optional]
**phone** | **String** | | [optional] [default to null] **phone** | **String** | | [optional]
**userStatus** | **int** | User Status | [optional] [default to null] **userStatus** | **int** | User Status | [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

@ -166,7 +166,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be deleted | [default to null] **username** | **String**| The name that needs to be deleted |
### Return type ### Return type
@ -207,7 +207,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] **username** | **String**| The name that needs to be fetched. Use user1 for testing. |
### Return type ### Return type
@ -249,8 +249,8 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| The user name for login | [default to null] **username** | **String**| The user name for login |
**password** | **String**| The password for login in clear text | [default to null] **password** | **String**| The password for login in clear text |
### Return type ### Return type
@ -329,7 +329,7 @@ try {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**username** | **String**| name that need to be deleted | [default to null] **username** | **String**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object | **body** | [**User**](User.md)| Updated user object |
### Return type ### Return type

View File

@ -2,11 +2,11 @@ part of openapi.api;
class ApiResponse { class ApiResponse {
int code = null; int code;
String type = null; String type;
String message = null; String message;
ApiResponse({ ApiResponse({
this.code, this.code,
@ -27,7 +27,7 @@ class ApiResponse {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
if (code != null) if (code != null)
json['code'] = code; json['code'] = code;
if (type != null) if (type != null)
@ -42,7 +42,7 @@ class ApiResponse {
} }
static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) { static Map<String, ApiResponse> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, ApiResponse>(); final map = Map<String, ApiResponse>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = ApiResponse.fromJson(value));
} }
@ -51,13 +51,13 @@ class ApiResponse {
// maps a json object with a list of ApiResponse-objects as value to a dart map // maps a json object with a list of ApiResponse-objects as value to a dart map
static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<ApiResponse>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<ApiResponse>>(); final map = Map<String, List<ApiResponse>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = ApiResponse.listFromJson(value); map[key] = ApiResponse.listFromJson(value);
}); });
} }
return map; return map;
} }
} }

View File

@ -2,9 +2,9 @@ part of openapi.api;
class Category { class Category {
int id = null; int id;
String name = null; String name;
Category({ Category({
this.id, this.id,
@ -23,7 +23,7 @@ class Category {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
if (id != null) if (id != null)
json['id'] = id; json['id'] = id;
if (name != null) if (name != null)
@ -36,7 +36,7 @@ class Category {
} }
static Map<String, Category> mapFromJson(Map<String, dynamic> json) { static Map<String, Category> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Category>(); final map = Map<String, Category>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = Category.fromJson(value));
} }
@ -45,13 +45,13 @@ class Category {
// maps a json object with a list of Category-objects as value to a dart map // maps a json object with a list of Category-objects as value to a dart map
static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Category>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Category>>(); final map = Map<String, List<Category>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Category.listFromJson(value); map[key] = Category.listFromJson(value);
}); });
} }
return map; return map;
} }
} }

View File

@ -2,16 +2,15 @@ part of openapi.api;
class Order { class Order {
int id = null; int id;
int petId = null; int petId;
int quantity = null; int quantity;
DateTime shipDate = null; DateTime shipDate;
/* Order Status */ /// Order Status
String status = null; OrderStatusEnum status;
//enum statusEnum { placed, approved, delivered, };{
bool complete = false; bool complete = false;
@ -21,7 +20,7 @@ class Order {
this.quantity, this.quantity,
this.shipDate, this.shipDate,
this.status, this.status,
this.complete, this.complete = false,
}); });
@override @override
@ -37,12 +36,12 @@ class Order {
shipDate = (json['shipDate'] == null) ? shipDate = (json['shipDate'] == null) ?
null : null :
DateTime.parse(json['shipDate']); DateTime.parse(json['shipDate']);
status = json['status']; status = OrderStatusEnum.fromJson(json['status']);
complete = json['complete']; complete = json['complete'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
if (id != null) if (id != null)
json['id'] = id; json['id'] = id;
if (petId != null) if (petId != null)
@ -52,7 +51,7 @@ class Order {
if (shipDate != null) if (shipDate != null)
json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String(); json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String();
if (status != null) if (status != null)
json['status'] = status; json['status'] = status.value;
if (complete != null) if (complete != null)
json['complete'] = complete; json['complete'] = complete;
return json; return json;
@ -63,7 +62,7 @@ class Order {
} }
static Map<String, Order> mapFromJson(Map<String, dynamic> json) { static Map<String, Order> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Order>(); final map = Map<String, Order>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = Order.fromJson(value));
} }
@ -72,13 +71,62 @@ class Order {
// maps a json object with a list of Order-objects as value to a dart map // maps a json object with a list of Order-objects as value to a dart map
static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Order>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Order>>(); final map = Map<String, List<Order>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Order.listFromJson(value); map[key] = Order.listFromJson(value);
}); });
} }
return map; return map;
}
}
class OrderStatusEnum {
/// The underlying value of this enum member.
final String value;
const OrderStatusEnum._internal(this.value);
/// Order Status
static const OrderStatusEnum placed_ = OrderStatusEnum._internal("placed");
/// Order Status
static const OrderStatusEnum approved_ = OrderStatusEnum._internal("approved");
/// Order Status
static const OrderStatusEnum delivered_ = OrderStatusEnum._internal("delivered");
String toJson () {
return value;
}
@override
String toString () {
return value;
}
static OrderStatusEnum fromJson(String value) {
return OrderStatusEnumTypeTransformer().decode(value);
}
static List<OrderStatusEnum> listFromJson(List<dynamic> json) {
return json == null
? List<OrderStatusEnum>()
: json.map((value) => OrderStatusEnum.fromJson(value)).toList();
} }
} }
class OrderStatusEnumTypeTransformer {
dynamic encode(OrderStatusEnum data) {
return data.value;
}
OrderStatusEnum decode(dynamic data) {
switch (data) {
case "placed": return OrderStatusEnum.placed_;
case "approved": return OrderStatusEnum.approved_;
case "delivered": return OrderStatusEnum.delivered_;
default: return null;
}
}
}

View File

@ -2,25 +2,24 @@ part of openapi.api;
class Pet { class Pet {
int id = null; int id;
Category category = null; Category category;
String name = null; String name;
List<String> photoUrls = []; List<String> photoUrls = const [];
List<Tag> tags = []; List<Tag> tags = const [];
/* pet status in the store */ /// pet status in the store
String status = null; PetStatusEnum status;
//enum statusEnum { available, pending, sold, };{
Pet({ Pet({
this.id, this.id,
this.category, this.category,
@required this.name, @required this.name,
@required this.photoUrls, @required this.photoUrls,
this.tags, this.tags = const [],
this.status, this.status,
}); });
@ -42,11 +41,11 @@ class Pet {
tags = (json['tags'] == null) ? tags = (json['tags'] == null) ?
null : null :
Tag.listFromJson(json['tags']); Tag.listFromJson(json['tags']);
status = json['status']; status = PetStatusEnum.fromJson(json['status']);
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
if (id != null) if (id != null)
json['id'] = id; json['id'] = id;
if (category != null) if (category != null)
@ -58,7 +57,7 @@ class Pet {
if (tags != null) if (tags != null)
json['tags'] = tags; json['tags'] = tags;
if (status != null) if (status != null)
json['status'] = status; json['status'] = status.value;
return json; return json;
} }
@ -67,7 +66,7 @@ class Pet {
} }
static Map<String, Pet> mapFromJson(Map<String, dynamic> json) { static Map<String, Pet> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Pet>(); final map = Map<String, Pet>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = Pet.fromJson(value));
} }
@ -76,13 +75,62 @@ class Pet {
// maps a json object with a list of Pet-objects as value to a dart map // maps a json object with a list of Pet-objects as value to a dart map
static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Pet>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Pet>>(); final map = Map<String, List<Pet>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Pet.listFromJson(value); map[key] = Pet.listFromJson(value);
}); });
} }
return map; return map;
}
}
class PetStatusEnum {
/// The underlying value of this enum member.
final String value;
const PetStatusEnum._internal(this.value);
/// pet status in the store
static const PetStatusEnum available_ = PetStatusEnum._internal("available");
/// pet status in the store
static const PetStatusEnum pending_ = PetStatusEnum._internal("pending");
/// pet status in the store
static const PetStatusEnum sold_ = PetStatusEnum._internal("sold");
String toJson () {
return value;
}
@override
String toString () {
return value;
}
static PetStatusEnum fromJson(String value) {
return PetStatusEnumTypeTransformer().decode(value);
}
static List<PetStatusEnum> listFromJson(List<dynamic> json) {
return json == null
? List<PetStatusEnum>()
: json.map((value) => PetStatusEnum.fromJson(value)).toList();
} }
} }
class PetStatusEnumTypeTransformer {
dynamic encode(PetStatusEnum data) {
return data.value;
}
PetStatusEnum decode(dynamic data) {
switch (data) {
case "available": return PetStatusEnum.available_;
case "pending": return PetStatusEnum.pending_;
case "sold": return PetStatusEnum.sold_;
default: return null;
}
}
}

View File

@ -2,9 +2,9 @@ part of openapi.api;
class Tag { class Tag {
int id = null; int id;
String name = null; String name;
Tag({ Tag({
this.id, this.id,
@ -23,7 +23,7 @@ class Tag {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
if (id != null) if (id != null)
json['id'] = id; json['id'] = id;
if (name != null) if (name != null)
@ -36,7 +36,7 @@ class Tag {
} }
static Map<String, Tag> mapFromJson(Map<String, dynamic> json) { static Map<String, Tag> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, Tag>(); final map = Map<String, Tag>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = Tag.fromJson(value));
} }
@ -45,13 +45,13 @@ class Tag {
// maps a json object with a list of Tag-objects as value to a dart map // maps a json object with a list of Tag-objects as value to a dart map
static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<Tag>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<Tag>>(); final map = Map<String, List<Tag>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = Tag.listFromJson(value); map[key] = Tag.listFromJson(value);
}); });
} }
return map; return map;
} }
} }

View File

@ -2,21 +2,21 @@ part of openapi.api;
class User { class User {
int id = null; int id;
String username = null; String username;
String firstName = null; String firstName;
String lastName = null; String lastName;
String email = null; String email;
String password = null; String password;
String phone = null; String phone;
/* User Status */ /// User Status
int userStatus = null; int userStatus;
User({ User({
this.id, this.id,
@ -47,7 +47,7 @@ class User {
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
Map <String, dynamic> json = {}; Map<String, dynamic> json = {};
if (id != null) if (id != null)
json['id'] = id; json['id'] = id;
if (username != null) if (username != null)
@ -72,7 +72,7 @@ class User {
} }
static Map<String, User> mapFromJson(Map<String, dynamic> json) { static Map<String, User> mapFromJson(Map<String, dynamic> json) {
var map = Map<String, User>(); final map = Map<String, User>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) => map[key] = User.fromJson(value)); json.forEach((String key, dynamic value) => map[key] = User.fromJson(value));
} }
@ -81,13 +81,13 @@ class User {
// maps a json object with a list of User-objects as value to a dart map // maps a json object with a list of User-objects as value to a dart map
static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json) { static Map<String, List<User>> mapListFromJson(Map<String, dynamic> json) {
var map = Map<String, List<User>>(); final map = Map<String, List<User>>();
if (json != null && json.isNotEmpty) { if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic value) { json.forEach((String key, dynamic value) {
map[key] = User.listFromJson(value); map[key] = User.listFromJson(value);
}); });
} }
return map; return map;
} }
} }