diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index d5222c0f8bd..049cf935f8c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -1768,7 +1768,7 @@ public class DefaultCodegen implements CodegenConfig { if (encoding != null) { codegenParameter.contentType = encoding.getContentType(); } 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 null if you do NOT want a default value. + * Any non-null value will cause {{#defaultValue} check to pass. + * * @param schema Property schema * @return string presentation of the default value of the property */ @@ -1810,7 +1813,7 @@ public class DefaultCodegen implements CodegenConfig { */ @SuppressWarnings("squid:S3923") private String getPropertyDefaultValue(Schema schema) { - /** + /* * Although all branches return null, this is left intentionally as examples for new contributors */ if (ModelUtils.isBooleanSchema(schema)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 2ba3d7be485..c27dc88a82c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -17,6 +17,7 @@ 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.Schema; @@ -30,9 +31,8 @@ import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; import java.io.InputStreamReader; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.*; 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 USE_ENUM_EXTENSION = "useEnumExtension"; public static final String SUPPORT_DART2 = "supportDart2"; + protected boolean browserClient = true; protected String pubName = "openapi"; protected String pubVersion = "1.0.0"; @@ -106,9 +107,11 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { modelTestTemplateFiles.put("model_test.mustache", ".dart"); apiTestTemplateFiles.put("api_test.mustache", ".dart"); - List reservedWordsList = new ArrayList(); + List reservedWordsList = new ArrayList<>(); 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()) { reservedWordsList.add(reader.readLine()); } @@ -118,18 +121,17 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { } setReservedWordsLowerCase(reservedWordsList); - languageSpecificPrimitives = new HashSet( - Arrays.asList( - "String", - "bool", - "int", - "num", - "double") + languageSpecificPrimitives = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double" ); instantiationTypes.put("array", "List"); instantiationTypes.put("map", "Map"); - typeMapping = new HashMap(); + typeMapping = new HashMap<>(); typeMapping.put("Array", "List"); typeMapping.put("array", "List"); typeMapping.put("List", "List"); @@ -329,7 +331,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { // replace - with _ e.g. created-at => created_at name = name.replaceAll("-", "_"); - // if it's all uppper case, do nothing + // if it's all upper case, do nothing if (name.matches("^[A-Z_]*$")) { return name; } @@ -403,9 +405,9 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toDefaultValue(Schema schema) { if (ModelUtils.isMapSchema(schema)) { - return "{}"; + return "const {}"; } else if (ModelUtils.isArraySchema(schema)) { - return "[]"; + return "const []"; } if (schema.getDefault() != null) { @@ -414,7 +416,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { } return schema.getDefault().toString(); } else { - return "null"; + return null; } } @@ -435,7 +437,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String getSchemaType(Schema p) { String openAPIType = super.getSchemaType(p); - String type = null; + String type; if (typeMapping.containsKey(openAPIType)) { type = typeMapping.get(openAPIType); if (languageSpecificPrimitives.contains(type)) { @@ -495,19 +497,16 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { return false; } Object extension = cm.vendorExtensions.get("x-enum-values"); - List> values = - (List>) extension; - List> enumVars = - new ArrayList>(); + List> values = (List>) extension; + List> enumVars = new ArrayList<>(); for (Map value : values) { - Map enumVar = new HashMap(); + Map enumVar = new HashMap<>(); String name = camelize((String) value.get("identifier"), true); if (isReservedWord(name)) { name = escapeReservedWord(name); } enumVar.put("name", name); - enumVar.put("value", toEnumValue( - value.get("numericValue").toString(), cm.dataType)); + enumVar.put("value", toEnumValue(value.get("numericValue").toString(), cm.dataType)); if (value.containsKey("description")) { 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) - Set supportedFileType = new HashSet( - Arrays.asList( - "supporting-mustache", - "model-test", - "model", - "api-test", - "api")); + Set supportedFileType = Sets.newHashSet( + "supporting-mustache", + "model-test", + "model", + "api-test", + "api"); if (!supportedFileType.contains(fileType)) { return; } @@ -632,7 +630,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { if (exitValue != 0) { LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); } else { - LOGGER.info("Successfully executed: " + command); + LOGGER.info("Successfully executed: {}", command); } } catch (Exception e) { LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index ef750c05f8f..21a1441642c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -130,13 +130,21 @@ public class DartDioClientCodegen extends DartClientCodegen { } @Override - public String toDefaultValue(Schema p) { - if (ModelUtils.isMapSchema(p)) { + public String toDefaultValue(Schema schema) { + if (ModelUtils.isMapSchema(schema)) { return "const {}"; - } else if (ModelUtils.isArraySchema(p)) { + } else if (ModelUtils.isArraySchema(schema)) { 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 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java index c5042947a17..b29946c56c5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java @@ -132,13 +132,21 @@ public class DartJaguarClientCodegen extends DartClientCodegen { } @Override - public String toDefaultValue(Schema p) { - if (ModelUtils.isMapSchema(p)) { + public String toDefaultValue(Schema schema) { + if (ModelUtils.isMapSchema(schema)) { return "const {}"; - } else if (ModelUtils.isArraySchema(p)) { + } else if (ModelUtils.isArraySchema(schema)) { 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 diff --git a/modules/openapi-generator/src/main/resources/dart/class.mustache b/modules/openapi-generator/src/main/resources/dart/class.mustache index b69af46ffaa..9739e84c69a 100644 --- a/modules/openapi-generator/src/main/resources/dart/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart/class.mustache @@ -1,7 +1,7 @@ class {{classname}} { {{#vars}} {{#description}}/* {{{description}}} */{{/description}} - {{{dataType}}} {{name}} = {{{defaultValue}}}; + {{^defaultValue}}{{{dataType}}} {{name}} = null;{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}} {{#allowableValues}} {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ {{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache index 0a32e58c7ab..2dca6c79051 100644 --- a/modules/openapi-generator/src/main/resources/dart2/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -1,15 +1,19 @@ class {{classname}} { {{#vars}} - {{#description}}/* {{{description}}} */{{/description}} - {{{dataType}}} {{name}} = {{{defaultValue}}}; + {{#description}}/// {{{description}}}{{/description}} + {{^isEnum}} + {{^defaultValue}}{{{dataType}}} {{name}};{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}} + {{/isEnum}} + {{#isEnum}} {{#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}} + {{/isEnum}} {{/vars}} {{classname}}({ {{#vars}} - {{#required}}@required this.{{name}},{{/required}}{{^required}}this.{{name}},{{/required}} + {{#required}}@required this.{{name}}{{/required}}{{^required}}this.{{name}}{{#defaultValue}} = {{defaultValue}}{{/defaultValue}}{{/required}}, {{/vars}} }); @@ -78,7 +82,12 @@ class {{classname}} { json['{{baseName}}'].toDouble(); {{/isDouble}} {{^isDouble}} + {{^isEnum}} {{name}} = json['{{baseName}}']; + {{/isEnum}} + {{#isEnum}} + {{name}} = {{classname}}{{{enumName}}}.fromJson(json['{{baseName}}']); + {{/isEnum}} {{/isDouble}} {{/isMapContainer}} {{/isListContainer}} @@ -89,7 +98,7 @@ class {{classname}} { } Map toJson() { - Map json = {}; + Map json = {}; {{#vars}} {{^isNullable}} if ({{name}} != null) @@ -102,7 +111,12 @@ class {{classname}} { {{/isDate}} {{^isDateTime}} {{^isDate}} + {{^isEnum}} json['{{baseName}}'] = {{name}}; + {{/isEnum}} + {{#isEnum}} + json['{{baseName}}'] = {{name}}.value; + {{/isEnum}} {{/isDate}} {{/isDateTime}} {{/vars}} @@ -114,7 +128,7 @@ class {{classname}} { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = {{classname}}.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = {{classname}}.listFromJson(value); + }); + } + return map; } } +{{#vars}} +{{#isEnum}} +{{>enum_inline}} +{{/isEnum}} +{{/vars}} diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache index 034d377f261..bdd82a16143 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -9,20 +9,27 @@ class {{classname}} { {{#description}} /// {{description}} {{/description}} - static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}}); + static const {{classname}} {{{name}}} = {{classname}}._internal({{value}}); {{/enumVars}} {{/allowableValues}} - {{dataType}} toJson (){ - return this.value; + {{dataType}} toJson () { + return value; + } + + @override + String toString () { + return value; } static {{classname}} fromJson({{dataType}} value) { - return new {{classname}}TypeTransformer().decode(value); + return {{classname}}TypeTransformer().decode(value); } static List<{{classname}}> listFromJson(List 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(); } } diff --git a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache new file mode 100644 index 00000000000..5ecc2b1a6ac --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache @@ -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 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; + } + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java index e9133bc605d..6e1a9974fda 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java @@ -36,6 +36,7 @@ public class DartModelTest { .addProperties("id", new IntegerSchema()) .addProperties("name", new StringSchema()) .addProperties("createdAt", new DateTimeSchema()) + .addProperties("defaultItem", new IntegerSchema()._default(1)) .addRequiredItem("id") .addRequiredItem("name"); final DefaultCodegen codegen = new DartClientCodegen(); @@ -46,7 +47,7 @@ public class DartModelTest { Assert.assertEquals(cm.name, "sample"); Assert.assertEquals(cm.classname, "Sample"); 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 //Assert.assertEquals(cm.imports.size(), 1); @@ -54,7 +55,7 @@ public class DartModelTest { Assert.assertEquals(property1.baseName, "id"); Assert.assertEquals(property1.dataType, "int"); Assert.assertEquals(property1.name, "id"); - Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertNull(property1.defaultValue); Assert.assertEquals(property1.baseType, "int"); Assert.assertTrue(property1.hasMore); Assert.assertTrue(property1.required); @@ -65,7 +66,7 @@ public class DartModelTest { Assert.assertEquals(property2.baseName, "name"); Assert.assertEquals(property2.dataType, "String"); Assert.assertEquals(property2.name, "name"); - Assert.assertEquals(property2.defaultValue, "null"); + Assert.assertNull(property2.defaultValue); Assert.assertEquals(property2.baseType, "String"); Assert.assertTrue(property2.hasMore); Assert.assertTrue(property2.required); @@ -77,11 +78,20 @@ public class DartModelTest { Assert.assertEquals(property3.complexType, "DateTime"); Assert.assertEquals(property3.dataType, "DateTime"); Assert.assertEquals(property3.name, "createdAt"); - Assert.assertEquals(property3.defaultValue, "null"); + Assert.assertNull(property3.defaultValue); Assert.assertEquals(property3.baseType, "DateTime"); - Assert.assertFalse(property3.hasMore); + Assert.assertTrue(property3.hasMore); Assert.assertFalse(property3.required); 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") @@ -89,9 +99,9 @@ public class DartModelTest { final Schema model = new Schema() .description("a sample model") .addProperties("id", new IntegerSchema()) - .addProperties("urls", new ArraySchema() - .items(new StringSchema())) + .addProperties("urls", new ArraySchema().items(new StringSchema())) .addRequiredItem("id"); + final DefaultCodegen codegen = new DartClientCodegen(); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); codegen.setOpenAPI(openAPI); @@ -106,7 +116,7 @@ public class DartModelTest { Assert.assertEquals(property1.baseName, "id"); Assert.assertEquals(property1.dataType, "int"); Assert.assertEquals(property1.name, "id"); - Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertNull(property1.defaultValue); Assert.assertEquals(property1.baseType, "int"); Assert.assertTrue(property1.hasMore); Assert.assertTrue(property1.required); diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/ApiResponse.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/ApiResponse.md index 92422f0f446..7ad5da0f89e 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/ApiResponse.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/ApiResponse.md @@ -8,9 +8,9 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [optional] [default to null] +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Category.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Category.md index cc0d1633b59..98d0b14be7b 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Category.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Category.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject.md index 1789b30bb81..9aa480dee58 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | Updated name of the pet | [optional] [default to null] -**status** | **String** | Updated status of the pet | [optional] [default to null] +**name** | **String** | Updated name of the pet | [optional] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject1.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject1.md index a5c2c120129..013aa87e9bb 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject1.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/InlineObject1.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**additionalMetadata** | **String** | Additional data to pass to server | [optional] [default to null] -**file** | [**MultipartFile**](File.md) | file to upload | [optional] [default to null] +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Order.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Order.md index 310ce6c65be..bde5ffe51a2 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Order.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Order.md @@ -8,11 +8,11 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] **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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Pet.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Pet.md index 191e1fc66a9..dc6c184bd03 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Pet.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Pet.md @@ -8,12 +8,12 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [optional] [default to null] +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | [default to const []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/PetApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/PetApi.md index 3a188dec3b3..e27d897b1c4 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/PetApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/PetApi.md @@ -88,8 +88,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] ### Return type @@ -134,7 +134,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -179,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -226,7 +226,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] + **petId** | **int**| ID of pet to return | ### Return type @@ -313,9 +313,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -360,9 +360,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] ### Return type diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/StoreApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/StoreApi.md index a3c03643770..9a722ebd9cc 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/StoreApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/StoreApi.md @@ -40,7 +40,7 @@ try { 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 @@ -126,7 +126,7 @@ try { 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 diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Tag.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Tag.md index ded7b32ac3d..c219f987c19 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/Tag.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Tag.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/User.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/User.md index 3761b70cf0b..fa87e64d859 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/User.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/User.md @@ -8,14 +8,14 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [optional] [default to null] +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/doc/UserApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/UserApi.md index ca539ab556f..8228ca37ca5 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/doc/UserApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/doc/UserApi.md @@ -182,7 +182,7 @@ try { 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 @@ -223,7 +223,7 @@ try { 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 @@ -265,8 +265,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -353,7 +353,7 @@ try { 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 | ### Return type diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart index 30db0ebc841..3552b385a11 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart @@ -8,9 +8,9 @@ class Pet { String name = null; - List photoUrls = []; + List photoUrls = const []; - List tags = []; + List tags = const []; /* pet status in the store */ String status = null; //enum statusEnum { available, pending, sold, };{ diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/ApiResponse.md b/samples/client/petstore/dart/openapi-browser-client/doc/ApiResponse.md index 92422f0f446..7ad5da0f89e 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/ApiResponse.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/ApiResponse.md @@ -8,9 +8,9 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [optional] [default to null] +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/Category.md b/samples/client/petstore/dart/openapi-browser-client/doc/Category.md index cc0d1633b59..98d0b14be7b 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/Category.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/Category.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/Order.md b/samples/client/petstore/dart/openapi-browser-client/doc/Order.md index 310ce6c65be..bde5ffe51a2 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/Order.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/Order.md @@ -8,11 +8,11 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] **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) diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/Pet.md b/samples/client/petstore/dart/openapi-browser-client/doc/Pet.md index 191e1fc66a9..dc6c184bd03 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/Pet.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/Pet.md @@ -8,12 +8,12 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [optional] [default to null] +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | [default to const []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**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) diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/PetApi.md b/samples/client/petstore/dart/openapi-browser-client/doc/PetApi.md index 5780e7f3802..a1e7858060f 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/PetApi.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/PetApi.md @@ -87,8 +87,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -178,7 +178,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -225,7 +225,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] + **petId** | **int**| ID of pet to return | ### Return type @@ -311,9 +311,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -358,9 +358,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] ### Return type diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/StoreApi.md b/samples/client/petstore/dart/openapi-browser-client/doc/StoreApi.md index df76647f11a..e5e8613c7af 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/StoreApi.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/StoreApi.md @@ -40,7 +40,7 @@ try { 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 @@ -126,7 +126,7 @@ try { 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 diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/Tag.md b/samples/client/petstore/dart/openapi-browser-client/doc/Tag.md index ded7b32ac3d..c219f987c19 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/Tag.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/Tag.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/User.md b/samples/client/petstore/dart/openapi-browser-client/doc/User.md index 3761b70cf0b..fa87e64d859 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/User.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/User.md @@ -8,14 +8,14 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [optional] [default to null] +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi-browser-client/doc/UserApi.md b/samples/client/petstore/dart/openapi-browser-client/doc/UserApi.md index d3bb61265e9..a07d2e4e4a4 100644 --- a/samples/client/petstore/dart/openapi-browser-client/doc/UserApi.md +++ b/samples/client/petstore/dart/openapi-browser-client/doc/UserApi.md @@ -166,7 +166,7 @@ try { 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 @@ -207,7 +207,7 @@ try { 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 @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -329,7 +329,7 @@ try { 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 | ### Return type diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart index 30db0ebc841..3552b385a11 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart @@ -8,9 +8,9 @@ class Pet { String name = null; - List photoUrls = []; + List photoUrls = const []; - List tags = []; + List tags = const []; /* pet status in the store */ String status = null; //enum statusEnum { available, pending, sold, };{ diff --git a/samples/client/petstore/dart/openapi/doc/ApiResponse.md b/samples/client/petstore/dart/openapi/doc/ApiResponse.md index 92422f0f446..7ad5da0f89e 100644 --- a/samples/client/petstore/dart/openapi/doc/ApiResponse.md +++ b/samples/client/petstore/dart/openapi/doc/ApiResponse.md @@ -8,9 +8,9 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [optional] [default to null] +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi/doc/Category.md b/samples/client/petstore/dart/openapi/doc/Category.md index cc0d1633b59..98d0b14be7b 100644 --- a/samples/client/petstore/dart/openapi/doc/Category.md +++ b/samples/client/petstore/dart/openapi/doc/Category.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi/doc/Order.md b/samples/client/petstore/dart/openapi/doc/Order.md index 310ce6c65be..bde5ffe51a2 100644 --- a/samples/client/petstore/dart/openapi/doc/Order.md +++ b/samples/client/petstore/dart/openapi/doc/Order.md @@ -8,11 +8,11 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] **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) diff --git a/samples/client/petstore/dart/openapi/doc/Pet.md b/samples/client/petstore/dart/openapi/doc/Pet.md index 191e1fc66a9..dc6c184bd03 100644 --- a/samples/client/petstore/dart/openapi/doc/Pet.md +++ b/samples/client/petstore/dart/openapi/doc/Pet.md @@ -8,12 +8,12 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [optional] [default to null] +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | [default to const []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**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) diff --git a/samples/client/petstore/dart/openapi/doc/PetApi.md b/samples/client/petstore/dart/openapi/doc/PetApi.md index 5780e7f3802..a1e7858060f 100644 --- a/samples/client/petstore/dart/openapi/doc/PetApi.md +++ b/samples/client/petstore/dart/openapi/doc/PetApi.md @@ -87,8 +87,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -178,7 +178,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -225,7 +225,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] + **petId** | **int**| ID of pet to return | ### Return type @@ -311,9 +311,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -358,9 +358,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] ### Return type diff --git a/samples/client/petstore/dart/openapi/doc/StoreApi.md b/samples/client/petstore/dart/openapi/doc/StoreApi.md index df76647f11a..e5e8613c7af 100644 --- a/samples/client/petstore/dart/openapi/doc/StoreApi.md +++ b/samples/client/petstore/dart/openapi/doc/StoreApi.md @@ -40,7 +40,7 @@ try { 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 @@ -126,7 +126,7 @@ try { 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 diff --git a/samples/client/petstore/dart/openapi/doc/Tag.md b/samples/client/petstore/dart/openapi/doc/Tag.md index ded7b32ac3d..c219f987c19 100644 --- a/samples/client/petstore/dart/openapi/doc/Tag.md +++ b/samples/client/petstore/dart/openapi/doc/Tag.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi/doc/User.md b/samples/client/petstore/dart/openapi/doc/User.md index 3761b70cf0b..fa87e64d859 100644 --- a/samples/client/petstore/dart/openapi/doc/User.md +++ b/samples/client/petstore/dart/openapi/doc/User.md @@ -8,14 +8,14 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [optional] [default to null] +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart/openapi/doc/UserApi.md b/samples/client/petstore/dart/openapi/doc/UserApi.md index d3bb61265e9..a07d2e4e4a4 100644 --- a/samples/client/petstore/dart/openapi/doc/UserApi.md +++ b/samples/client/petstore/dart/openapi/doc/UserApi.md @@ -166,7 +166,7 @@ try { 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 @@ -207,7 +207,7 @@ try { 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 @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -329,7 +329,7 @@ try { 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 | ### Return type diff --git a/samples/client/petstore/dart/openapi/lib/model/pet.dart b/samples/client/petstore/dart/openapi/lib/model/pet.dart index 30db0ebc841..3552b385a11 100644 --- a/samples/client/petstore/dart/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart/openapi/lib/model/pet.dart @@ -8,9 +8,9 @@ class Pet { String name = null; - List photoUrls = []; + List photoUrls = const []; - List tags = []; + List tags = const []; /* pet status in the store */ String status = null; //enum statusEnum { available, pending, sold, };{ diff --git a/samples/client/petstore/dart2/openapi/lib/model/order.dart b/samples/client/petstore/dart2/openapi/lib/model/order.dart index 34370b21e3b..66cbd07902f 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/order.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/order.dart @@ -9,12 +9,10 @@ class Order { int quantity = null; DateTime shipDate = null; - /* Order Status */ - String status = null; - //enum statusEnum { placed, approved, delivered, };{ - + /// Order Status + StatusEnum status = null; + bool complete = false; - Order(); @override String toString() { @@ -65,12 +63,14 @@ class Order { // maps a json object with a list of Order-objects as value to a dart map static Map> mapListFromJson(Map json) { var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Order.listFromJson(value); - }); - } - return map; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Order.listFromJson(value); + }); + } + return map; } } + +enum StatusEnum { placed, approved, delivered, } diff --git a/samples/client/petstore/dart2/openapi/lib/model/pet.dart b/samples/client/petstore/dart2/openapi/lib/model/pet.dart index 92a096c4027..09c1325f9ca 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/pet.dart @@ -11,10 +11,8 @@ class Pet { List photoUrls = []; List tags = []; - /* pet status in the store */ - String status = null; - //enum statusEnum { available, pending, sold, };{ - Pet(); + /// pet status in the store + StatusEnum status = null; @override String toString() { @@ -69,12 +67,14 @@ class Pet { // maps a json object with a list of Pet-objects as value to a dart map static Map> mapListFromJson(Map json) { var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Pet.listFromJson(value); - }); - } - return map; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Pet.listFromJson(value); + }); + } + return map; } } + +enum StatusEnum { available, pending, sold, } diff --git a/samples/client/petstore/dart2/openapi/lib/model/tag.dart b/samples/client/petstore/dart2/openapi/lib/model/tag.dart index 5b758c01b7a..01be72b5806 100644 --- a/samples/client/petstore/dart2/openapi/lib/model/tag.dart +++ b/samples/client/petstore/dart2/openapi/lib/model/tag.dart @@ -5,7 +5,6 @@ class Tag { int id = null; String name = null; - Tag(); @override String toString() { @@ -42,12 +41,11 @@ class Tag { // maps a json object with a list of Tag-objects as value to a dart map static Map> mapListFromJson(Map json) { var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Tag.listFromJson(value); - }); - } - return map; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Tag.listFromJson(value); + }); + } + return map; } } - diff --git a/samples/client/petstore/dart2/petstore/test/order_model_test.dart b/samples/client/petstore/dart2/petstore/test/order_model_test.dart new file mode 100644 index 00000000000..9cdc65fe52d --- /dev/null +++ b/samples/client/petstore/dart2/petstore/test/order_model_test.dart @@ -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)); + }); +} diff --git a/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart index 376b02b47eb..ada6c5fd444 100644 --- a/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart +++ b/samples/client/petstore/dart2/petstore/test/pet_faked_client_test.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'dart:math'; import 'package:http/http.dart'; import 'package:openapi/api.dart'; @@ -31,7 +32,7 @@ void main() { ..category = category ..tags = tags ..name = name - ..status = status + ..status = PetStatusEnum.fromJson(status) ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; } @@ -188,10 +189,10 @@ void main() { final id1 = newId(); final id2 = newId(); final id3 = newId(); - final status = 'available'; + final status = PetStatusEnum.available_.value; final pet1 = makePet(id: id1, 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)]) .then((_) async { @@ -202,6 +203,10 @@ void main() { getResponseBody: petApi.apiClient.serialize([pet1, pet2]), ); 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(); expect(petIds, contains(id1)); expect(petIds, contains(id2)); diff --git a/samples/client/petstore/dart2/petstore/test/pet_test.dart b/samples/client/petstore/dart2/petstore/test/pet_test.dart index 1ec614e0fdd..10a71acd9a0 100644 --- a/samples/client/petstore/dart2/petstore/test/pet_test.dart +++ b/samples/client/petstore/dart2/petstore/test/pet_test.dart @@ -25,14 +25,16 @@ void main() { ..id = 124321 ..name = 'Jose' ]; + return Pet( id : id, category: category, name: name, //required field + tags: tags, photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field ) - ..tags = tags - ..status = ''; + ..status = PetStatusEnum.fromJson(status) + ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; } group('Pet API with live client', () { @@ -79,12 +81,12 @@ void main() { var id1 = newId(); var id2 = newId(); var id3 = newId(); - var status = 'available'; + var status = PetStatusEnum.available_.value; return Future.wait([ petApi.addPet(makePet(id: id1, 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 { var pets = await petApi.findPetsByStatus([status]); var petIds = pets.map((pet) => pet.id).toList(); diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md b/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md index 92422f0f446..7ad5da0f89e 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md @@ -8,9 +8,9 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | [optional] [default to null] -**type** | **String** | | [optional] [default to null] -**message** | **String** | | [optional] [default to null] +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md index cc0d1633b59..98d0b14be7b 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md index 310ce6c65be..bde5ffe51a2 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md @@ -8,11 +8,11 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**petId** | **int** | | [optional] [default to null] -**quantity** | **int** | | [optional] [default to null] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] **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) diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md index 191e1fc66a9..dc6c184bd03 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md @@ -8,12 +8,12 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**category** | [**Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photoUrls** | **List<String>** | | [default to []] -**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] -**status** | **String** | pet status in the store | [optional] [default to null] +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **List<String>** | | [default to const []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**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) diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md index 7b5de3894a9..cdd56362b2d 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md @@ -87,8 +87,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | [default to null] - **apiKey** | **String**| | [optional] [default to null] + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] ### Return type @@ -178,7 +178,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] ### Return type @@ -225,7 +225,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | [default to null] + **petId** | **int**| ID of pet to return | ### Return type @@ -311,9 +311,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | [default to null] - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -358,9 +358,9 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **MultipartFile**| file to upload | [optional] [default to null] + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] ### Return type diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md index 1cc37e2a47a..6ff167fc834 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md @@ -40,7 +40,7 @@ try { 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 @@ -126,7 +126,7 @@ try { 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 diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md index ded7b32ac3d..c219f987c19 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md @@ -8,8 +8,8 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **int** | | [optional] +**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) diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/User.md b/samples/client/petstore/dart2/petstore_client_lib/doc/User.md index 3761b70cf0b..fa87e64d859 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/User.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/User.md @@ -8,14 +8,14 @@ import 'package:openapi/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**firstName** | **String** | | [optional] [default to null] -**lastName** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**userStatus** | **int** | User Status | [optional] [default to null] +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**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) diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md index 1ee5f6fced6..f3809ef73a3 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md @@ -166,7 +166,7 @@ try { 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 @@ -207,7 +207,7 @@ try { 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 @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [default to null] - **password** | **String**| The password for login in clear text | [default to null] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -329,7 +329,7 @@ try { 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 | ### Return type diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart index ddc3cafb99d..423d533a97b 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart @@ -2,11 +2,11 @@ part of openapi.api; class ApiResponse { - int code = null; + int code; - String type = null; + String type; - String message = null; + String message; ApiResponse({ this.code, @@ -27,7 +27,7 @@ class ApiResponse { } Map toJson() { - Map json = {}; + Map json = {}; if (code != null) json['code'] = code; if (type != null) @@ -42,7 +42,7 @@ class ApiResponse { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = ApiResponse.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = ApiResponse.listFromJson(value); + }); + } + return map; } } diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart index 3bcb27396bc..243b8855d35 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/category.dart @@ -2,9 +2,9 @@ part of openapi.api; class Category { - int id = null; + int id; - String name = null; + String name; Category({ this.id, @@ -23,7 +23,7 @@ class Category { } Map toJson() { - Map json = {}; + Map json = {}; if (id != null) json['id'] = id; if (name != null) @@ -36,7 +36,7 @@ class Category { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Category.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Category.listFromJson(value); + }); + } + return map; } } diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart index f313282411e..821b59586aa 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/order.dart @@ -2,16 +2,15 @@ part of openapi.api; class Order { - int id = null; + int id; - int petId = null; + int petId; - int quantity = null; + int quantity; - DateTime shipDate = null; - /* Order Status */ - String status = null; - //enum statusEnum { placed, approved, delivered, };{ + DateTime shipDate; + /// Order Status + OrderStatusEnum status; bool complete = false; @@ -21,7 +20,7 @@ class Order { this.quantity, this.shipDate, this.status, - this.complete, + this.complete = false, }); @override @@ -37,12 +36,12 @@ class Order { shipDate = (json['shipDate'] == null) ? null : DateTime.parse(json['shipDate']); - status = json['status']; + status = OrderStatusEnum.fromJson(json['status']); complete = json['complete']; } Map toJson() { - Map json = {}; + Map json = {}; if (id != null) json['id'] = id; if (petId != null) @@ -52,7 +51,7 @@ class Order { if (shipDate != null) json['shipDate'] = shipDate == null ? null : shipDate.toUtc().toIso8601String(); if (status != null) - json['status'] = status; + json['status'] = status.value; if (complete != null) json['complete'] = complete; return json; @@ -63,7 +62,7 @@ class Order { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Order.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Order.listFromJson(value); + }); + } + 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 listFromJson(List json) { + return json == null + ? List() + : 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; + } + } +} + + diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart index 507661984e2..0999f9f638e 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/pet.dart @@ -2,25 +2,24 @@ part of openapi.api; class Pet { - int id = null; + int id; - Category category = null; + Category category; - String name = null; + String name; - List photoUrls = []; + List photoUrls = const []; - List tags = []; - /* pet status in the store */ - String status = null; - //enum statusEnum { available, pending, sold, };{ + List tags = const []; + /// pet status in the store + PetStatusEnum status; Pet({ this.id, this.category, @required this.name, @required this.photoUrls, - this.tags, + this.tags = const [], this.status, }); @@ -42,11 +41,11 @@ class Pet { tags = (json['tags'] == null) ? null : Tag.listFromJson(json['tags']); - status = json['status']; + status = PetStatusEnum.fromJson(json['status']); } Map toJson() { - Map json = {}; + Map json = {}; if (id != null) json['id'] = id; if (category != null) @@ -58,7 +57,7 @@ class Pet { if (tags != null) json['tags'] = tags; if (status != null) - json['status'] = status; + json['status'] = status.value; return json; } @@ -67,7 +66,7 @@ class Pet { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Pet.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Pet.listFromJson(value); + }); + } + 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 listFromJson(List json) { + return json == null + ? List() + : 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; + } + } +} + + diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart index 743382dc408..0907897e1c8 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/tag.dart @@ -2,9 +2,9 @@ part of openapi.api; class Tag { - int id = null; + int id; - String name = null; + String name; Tag({ this.id, @@ -23,7 +23,7 @@ class Tag { } Map toJson() { - Map json = {}; + Map json = {}; if (id != null) json['id'] = id; if (name != null) @@ -36,7 +36,7 @@ class Tag { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = Tag.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = Tag.listFromJson(value); + }); + } + return map; } } diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart index b7ce4924183..29fb77ec966 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/model/user.dart @@ -2,21 +2,21 @@ part of openapi.api; 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; - /* User Status */ - int userStatus = null; + String phone; + /// User Status + int userStatus; User({ this.id, @@ -47,7 +47,7 @@ class User { } Map toJson() { - Map json = {}; + Map json = {}; if (id != null) json['id'] = id; if (username != null) @@ -72,7 +72,7 @@ class User { } static Map mapFromJson(Map json) { - var map = Map(); + final map = Map(); if (json != null && json.isNotEmpty) { 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 static Map> mapListFromJson(Map json) { - var map = Map>(); - if (json != null && json.isNotEmpty) { - json.forEach((String key, dynamic value) { - map[key] = User.listFromJson(value); - }); - } - return map; + final map = Map>(); + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic value) { + map[key] = User.listFromJson(value); + }); + } + return map; } }