Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class {{{classname}}} {
String toString() => '{{{classname}}}[{{#vars}}{{{name}}}=${{{name}}}{{^-last}}, {{/-last}}{{/vars}}]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
{{#vars}}
{{#isNullable}}
if ({{{name}}} != null) {
Expand All @@ -66,27 +66,27 @@ class {{{classname}}} {
{{/isNullable}}
{{#isDateTime}}
{{#pattern}}
json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
_json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch
: {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String();
{{/pattern}}
{{^pattern}}
json[r'{{{baseName}}}'] = {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String();
_json[r'{{{baseName}}}'] = {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String();
{{/pattern}}
{{/isDateTime}}
{{#isDate}}
{{#pattern}}
json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
_json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
? {{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch
: _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc());
{{/pattern}}
{{^pattern}}
json[r'{{{baseName}}}'] = _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc());
_json[r'{{{baseName}}}'] = _dateFormatter.format({{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc());
{{/pattern}}
{{/isDate}}
{{^isDateTime}}
{{^isDate}}
json[r'{{{baseName}}}'] = {{{name}}};
_json[r'{{{baseName}}}'] = {{{name}}};
{{/isDate}}
{{/isDateTime}}
{{#isNullable}}
Expand All @@ -100,7 +100,7 @@ class {{{classname}}} {
{{/required}}
{{/isNullable}}
{{/vars}}
return json;
return _json;
}

/// Returns a new [{{{classname}}}] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ class ApiResponse {
String toString() => 'ApiResponse[code=$code, type=$type, message=$message]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (code != null) {
json[r'code'] = code;
_json[r'code'] = code;
}
if (type != null) {
json[r'type'] = type;
_json[r'type'] = type;
}
if (message != null) {
json[r'message'] = message;
_json[r'message'] = message;
}
return json;
return _json;
}

/// Returns a new [ApiResponse] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ class Category {
String toString() => 'Category[id=$id, name=$name]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
_json[r'id'] = id;
}
if (name != null) {
json[r'name'] = name;
_json[r'name'] = name;
}
return json;
return _json;
}

/// Returns a new [Category] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,24 @@ class Order {
String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
_json[r'id'] = id;
}
if (petId != null) {
json[r'petId'] = petId;
_json[r'petId'] = petId;
}
if (quantity != null) {
json[r'quantity'] = quantity;
_json[r'quantity'] = quantity;
}
if (shipDate != null) {
json[r'shipDate'] = shipDate!.toUtc().toIso8601String();
_json[r'shipDate'] = shipDate!.toUtc().toIso8601String();
}
if (status != null) {
json[r'status'] = status;
_json[r'status'] = status;
}
json[r'complete'] = complete;
return json;
_json[r'complete'] = complete;
return _json;
}

/// Returns a new [Order] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@ class Pet {
String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
_json[r'id'] = id;
}
if (category != null) {
json[r'category'] = category;
_json[r'category'] = category;
}
json[r'name'] = name;
json[r'photoUrls'] = photoUrls;
json[r'tags'] = tags;
_json[r'name'] = name;
_json[r'photoUrls'] = photoUrls;
_json[r'tags'] = tags;
if (status != null) {
json[r'status'] = status;
_json[r'status'] = status;
}
return json;
return _json;
}

/// Returns a new [Pet] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ class Tag {
String toString() => 'Tag[id=$id, name=$name]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
_json[r'id'] = id;
}
if (name != null) {
json[r'name'] = name;
_json[r'name'] = name;
}
return json;
return _json;
}

/// Returns a new [Tag] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,32 +115,32 @@ class User {
String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
_json[r'id'] = id;
}
if (username != null) {
json[r'username'] = username;
_json[r'username'] = username;
}
if (firstName != null) {
json[r'firstName'] = firstName;
_json[r'firstName'] = firstName;
}
if (lastName != null) {
json[r'lastName'] = lastName;
_json[r'lastName'] = lastName;
}
if (email != null) {
json[r'email'] = email;
_json[r'email'] = email;
}
if (password != null) {
json[r'password'] = password;
_json[r'password'] = password;
}
if (phone != null) {
json[r'phone'] = phone;
_json[r'phone'] = phone;
}
if (userStatus != null) {
json[r'userStatus'] = userStatus;
_json[r'userStatus'] = userStatus;
}
return json;
return _json;
}

/// Returns a new [User] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class AdditionalPropertiesClass {
String toString() => 'AdditionalPropertiesClass[mapProperty=$mapProperty, mapOfMapProperty=$mapOfMapProperty]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'map_property'] = mapProperty;
json[r'map_of_map_property'] = mapOfMapProperty;
return json;
final _json = <String, dynamic>{};
_json[r'map_property'] = mapProperty;
_json[r'map_of_map_property'] = mapOfMapProperty;
return _json;
}

/// Returns a new [AdditionalPropertiesClass] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class Animal {
String toString() => 'Animal[className=$className, color=$color]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'className'] = className;
json[r'color'] = color;
return json;
final _json = <String, dynamic>{};
_json[r'className'] = className;
_json[r'color'] = color;
return _json;
}

/// Returns a new [Animal] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ class ApiResponse {
String toString() => 'ApiResponse[code=$code, type=$type, message=$message]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (code != null) {
json[r'code'] = code;
_json[r'code'] = code;
}
if (type != null) {
json[r'type'] = type;
_json[r'type'] = type;
}
if (message != null) {
json[r'message'] = message;
_json[r'message'] = message;
}
return json;
return _json;
}

/// Returns a new [ApiResponse] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class ArrayOfArrayOfNumberOnly {
String toString() => 'ArrayOfArrayOfNumberOnly[arrayArrayNumber=$arrayArrayNumber]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'ArrayArrayNumber'] = arrayArrayNumber;
return json;
final _json = <String, dynamic>{};
_json[r'ArrayArrayNumber'] = arrayArrayNumber;
return _json;
}

/// Returns a new [ArrayOfArrayOfNumberOnly] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class ArrayOfNumberOnly {
String toString() => 'ArrayOfNumberOnly[arrayNumber=$arrayNumber]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'ArrayNumber'] = arrayNumber;
return json;
final _json = <String, dynamic>{};
_json[r'ArrayNumber'] = arrayNumber;
return _json;
}

/// Returns a new [ArrayOfNumberOnly] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ class ArrayTest {
String toString() => 'ArrayTest[arrayOfString=$arrayOfString, arrayArrayOfInteger=$arrayArrayOfInteger, arrayArrayOfModel=$arrayArrayOfModel]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'array_of_string'] = arrayOfString;
json[r'array_array_of_integer'] = arrayArrayOfInteger;
json[r'array_array_of_model'] = arrayArrayOfModel;
return json;
final _json = <String, dynamic>{};
_json[r'array_of_string'] = arrayOfString;
_json[r'array_array_of_integer'] = arrayArrayOfInteger;
_json[r'array_array_of_model'] = arrayArrayOfModel;
return _json;
}

/// Returns a new [ArrayTest] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,26 @@ class Capitalization {
String toString() => 'Capitalization[smallCamel=$smallCamel, capitalCamel=$capitalCamel, smallSnake=$smallSnake, capitalSnake=$capitalSnake, sCAETHFlowPoints=$sCAETHFlowPoints, ATT_NAME=$ATT_NAME]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (smallCamel != null) {
json[r'smallCamel'] = smallCamel;
_json[r'smallCamel'] = smallCamel;
}
if (capitalCamel != null) {
json[r'CapitalCamel'] = capitalCamel;
_json[r'CapitalCamel'] = capitalCamel;
}
if (smallSnake != null) {
json[r'small_Snake'] = smallSnake;
_json[r'small_Snake'] = smallSnake;
}
if (capitalSnake != null) {
json[r'Capital_Snake'] = capitalSnake;
_json[r'Capital_Snake'] = capitalSnake;
}
if (sCAETHFlowPoints != null) {
json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints;
_json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints;
}
if (ATT_NAME != null) {
json[r'ATT_NAME'] = ATT_NAME;
_json[r'ATT_NAME'] = ATT_NAME;
}
return json;
return _json;
}

/// Returns a new [Capitalization] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class Cat {
String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'className'] = className;
json[r'color'] = color;
final _json = <String, dynamic>{};
_json[r'className'] = className;
_json[r'color'] = color;
if (declawed != null) {
json[r'declawed'] = declawed;
_json[r'declawed'] = declawed;
}
return json;
return _json;
}

/// Returns a new [Cat] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class CatAllOf {
String toString() => 'CatAllOf[declawed=$declawed]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (declawed != null) {
json[r'declawed'] = declawed;
_json[r'declawed'] = declawed;
}
return json;
return _json;
}

/// Returns a new [CatAllOf] instance and imports its values from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class Category {
String toString() => 'Category[id=$id, name=$name]';

Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
final _json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
_json[r'id'] = id;
}
json[r'name'] = name;
return json;
_json[r'name'] = name;
return _json;
}

/// Returns a new [Category] instance and imports its values from
Expand Down
Loading