Put null values into serialized output in dart2 generator (#12569)

* Put null values into serialized output in dart2 generator

* Update samples
This commit is contained in:
jld3103 2022-06-25 04:07:00 +02:00 committed by GitHub
parent 52452750c0
commit 2c9bd4a28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 234 additions and 0 deletions

View File

@ -90,11 +90,15 @@ class {{{classname}}} {
{{/isDate}} {{/isDate}}
{{/isDateTime}} {{/isDateTime}}
{{#isNullable}} {{#isNullable}}
} else {
_json[r'{{{baseName}}}'] = null;
} }
{{/isNullable}} {{/isNullable}}
{{^isNullable}} {{^isNullable}}
{{^required}} {{^required}}
{{^defaultValue}} {{^defaultValue}}
} else {
_json[r'{{{baseName}}}'] = null;
} }
{{/defaultValue}} {{/defaultValue}}
{{/required}} {{/required}}

View File

@ -62,12 +62,18 @@ class ApiResponse {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (code != null) { if (code != null) {
_json[r'code'] = code; _json[r'code'] = code;
} else {
_json[r'code'] = null;
} }
if (type != null) { if (type != null) {
_json[r'type'] = type; _json[r'type'] = type;
} else {
_json[r'type'] = null;
} }
if (message != null) { if (message != null) {
_json[r'message'] = message; _json[r'message'] = message;
} else {
_json[r'message'] = null;
} }
return _json; return _json;
} }

View File

@ -51,9 +51,13 @@ class Category {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (name != null) { if (name != null) {
_json[r'name'] = name; _json[r'name'] = name;
} else {
_json[r'name'] = null;
} }
return _json; return _json;
} }

View File

@ -84,18 +84,28 @@ class Order {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (petId != null) { if (petId != null) {
_json[r'petId'] = petId; _json[r'petId'] = petId;
} else {
_json[r'petId'] = null;
} }
if (quantity != null) { if (quantity != null) {
_json[r'quantity'] = quantity; _json[r'quantity'] = quantity;
} else {
_json[r'quantity'] = null;
} }
if (shipDate != null) { if (shipDate != null) {
_json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); _json[r'shipDate'] = shipDate!.toUtc().toIso8601String();
} else {
_json[r'shipDate'] = null;
} }
if (status != null) { if (status != null) {
_json[r'status'] = status; _json[r'status'] = status;
} else {
_json[r'status'] = null;
} }
_json[r'complete'] = complete; _json[r'complete'] = complete;
return _json; return _json;

View File

@ -72,15 +72,21 @@ class Pet {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (category != null) { if (category != null) {
_json[r'category'] = category; _json[r'category'] = category;
} else {
_json[r'category'] = null;
} }
_json[r'name'] = name; _json[r'name'] = name;
_json[r'photoUrls'] = photoUrls; _json[r'photoUrls'] = photoUrls;
_json[r'tags'] = tags; _json[r'tags'] = tags;
if (status != null) { if (status != null) {
_json[r'status'] = status; _json[r'status'] = status;
} else {
_json[r'status'] = null;
} }
return _json; return _json;
} }

View File

@ -51,9 +51,13 @@ class Tag {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (name != null) { if (name != null) {
_json[r'name'] = name; _json[r'name'] = name;
} else {
_json[r'name'] = null;
} }
return _json; return _json;
} }

View File

@ -118,27 +118,43 @@ class User {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (username != null) { if (username != null) {
_json[r'username'] = username; _json[r'username'] = username;
} else {
_json[r'username'] = null;
} }
if (firstName != null) { if (firstName != null) {
_json[r'firstName'] = firstName; _json[r'firstName'] = firstName;
} else {
_json[r'firstName'] = null;
} }
if (lastName != null) { if (lastName != null) {
_json[r'lastName'] = lastName; _json[r'lastName'] = lastName;
} else {
_json[r'lastName'] = null;
} }
if (email != null) { if (email != null) {
_json[r'email'] = email; _json[r'email'] = email;
} else {
_json[r'email'] = null;
} }
if (password != null) { if (password != null) {
_json[r'password'] = password; _json[r'password'] = password;
} else {
_json[r'password'] = null;
} }
if (phone != null) { if (phone != null) {
_json[r'phone'] = phone; _json[r'phone'] = phone;
} else {
_json[r'phone'] = null;
} }
if (userStatus != null) { if (userStatus != null) {
_json[r'userStatus'] = userStatus; _json[r'userStatus'] = userStatus;
} else {
_json[r'userStatus'] = null;
} }
return _json; return _json;
} }

View File

@ -45,9 +45,13 @@ class AllOfWithSingleRef {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (username != null) { if (username != null) {
_json[r'username'] = username; _json[r'username'] = username;
} else {
_json[r'username'] = null;
} }
if (singleRefType != null) { if (singleRefType != null) {
_json[r'SingleRefType'] = singleRefType; _json[r'SingleRefType'] = singleRefType;
} else {
_json[r'SingleRefType'] = null;
} }
return _json; return _json;
} }

View File

@ -62,12 +62,18 @@ class ApiResponse {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (code != null) { if (code != null) {
_json[r'code'] = code; _json[r'code'] = code;
} else {
_json[r'code'] = null;
} }
if (type != null) { if (type != null) {
_json[r'type'] = type; _json[r'type'] = type;
} else {
_json[r'type'] = null;
} }
if (message != null) { if (message != null) {
_json[r'message'] = message; _json[r'message'] = message;
} else {
_json[r'message'] = null;
} }
return _json; return _json;
} }

View File

@ -96,21 +96,33 @@ class Capitalization {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (smallCamel != null) { if (smallCamel != null) {
_json[r'smallCamel'] = smallCamel; _json[r'smallCamel'] = smallCamel;
} else {
_json[r'smallCamel'] = null;
} }
if (capitalCamel != null) { if (capitalCamel != null) {
_json[r'CapitalCamel'] = capitalCamel; _json[r'CapitalCamel'] = capitalCamel;
} else {
_json[r'CapitalCamel'] = null;
} }
if (smallSnake != null) { if (smallSnake != null) {
_json[r'small_Snake'] = smallSnake; _json[r'small_Snake'] = smallSnake;
} else {
_json[r'small_Snake'] = null;
} }
if (capitalSnake != null) { if (capitalSnake != null) {
_json[r'Capital_Snake'] = capitalSnake; _json[r'Capital_Snake'] = capitalSnake;
} else {
_json[r'Capital_Snake'] = null;
} }
if (sCAETHFlowPoints != null) { if (sCAETHFlowPoints != null) {
_json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints; _json[r'SCA_ETH_Flow_Points'] = sCAETHFlowPoints;
} else {
_json[r'SCA_ETH_Flow_Points'] = null;
} }
if (ATT_NAME != null) { if (ATT_NAME != null) {
_json[r'ATT_NAME'] = ATT_NAME; _json[r'ATT_NAME'] = ATT_NAME;
} else {
_json[r'ATT_NAME'] = null;
} }
return _json; return _json;
} }

View File

@ -52,6 +52,8 @@ class Cat {
_json[r'color'] = color; _json[r'color'] = color;
if (declawed != null) { if (declawed != null) {
_json[r'declawed'] = declawed; _json[r'declawed'] = declawed;
} else {
_json[r'declawed'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class CatAllOf {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (declawed != null) { if (declawed != null) {
_json[r'declawed'] = declawed; _json[r'declawed'] = declawed;
} else {
_json[r'declawed'] = null;
} }
return _json; return _json;
} }

View File

@ -45,6 +45,8 @@ class Category {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
_json[r'name'] = name; _json[r'name'] = name;
return _json; return _json;

View File

@ -40,6 +40,8 @@ class ClassModel {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (class_ != null) { if (class_ != null) {
_json[r'_class'] = class_; _json[r'_class'] = class_;
} else {
_json[r'_class'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class DeprecatedObject {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (name != null) { if (name != null) {
_json[r'name'] = name; _json[r'name'] = name;
} else {
_json[r'name'] = null;
} }
return _json; return _json;
} }

View File

@ -52,6 +52,8 @@ class Dog {
_json[r'color'] = color; _json[r'color'] = color;
if (breed != null) { if (breed != null) {
_json[r'breed'] = breed; _json[r'breed'] = breed;
} else {
_json[r'breed'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class DogAllOf {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (breed != null) { if (breed != null) {
_json[r'breed'] = breed; _json[r'breed'] = breed;
} else {
_json[r'breed'] = null;
} }
return _json; return _json;
} }

View File

@ -39,6 +39,8 @@ class EnumArrays {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (justSymbol != null) { if (justSymbol != null) {
_json[r'just_symbol'] = justSymbol; _json[r'just_symbol'] = justSymbol;
} else {
_json[r'just_symbol'] = null;
} }
_json[r'array_enum'] = arrayEnum; _json[r'array_enum'] = arrayEnum;
return _json; return _json;

View File

@ -87,25 +87,39 @@ class EnumTest {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (enumString != null) { if (enumString != null) {
_json[r'enum_string'] = enumString; _json[r'enum_string'] = enumString;
} else {
_json[r'enum_string'] = null;
} }
_json[r'enum_string_required'] = enumStringRequired; _json[r'enum_string_required'] = enumStringRequired;
if (enumInteger != null) { if (enumInteger != null) {
_json[r'enum_integer'] = enumInteger; _json[r'enum_integer'] = enumInteger;
} else {
_json[r'enum_integer'] = null;
} }
if (enumNumber != null) { if (enumNumber != null) {
_json[r'enum_number'] = enumNumber; _json[r'enum_number'] = enumNumber;
} else {
_json[r'enum_number'] = null;
} }
if (outerEnum != null) { if (outerEnum != null) {
_json[r'outerEnum'] = outerEnum; _json[r'outerEnum'] = outerEnum;
} else {
_json[r'outerEnum'] = null;
} }
if (outerEnumInteger != null) { if (outerEnumInteger != null) {
_json[r'outerEnumInteger'] = outerEnumInteger; _json[r'outerEnumInteger'] = outerEnumInteger;
} else {
_json[r'outerEnumInteger'] = null;
} }
if (outerEnumDefaultValue != null) { if (outerEnumDefaultValue != null) {
_json[r'outerEnumDefaultValue'] = outerEnumDefaultValue; _json[r'outerEnumDefaultValue'] = outerEnumDefaultValue;
} else {
_json[r'outerEnumDefaultValue'] = null;
} }
if (outerEnumIntegerDefaultValue != null) { if (outerEnumIntegerDefaultValue != null) {
_json[r'outerEnumIntegerDefaultValue'] = outerEnumIntegerDefaultValue; _json[r'outerEnumIntegerDefaultValue'] = outerEnumIntegerDefaultValue;
} else {
_json[r'outerEnumIntegerDefaultValue'] = null;
} }
return _json; return _json;
} }

View File

@ -45,6 +45,8 @@ class FileSchemaTestClass {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (file != null) { if (file != null) {
_json[r'file'] = file; _json[r'file'] = file;
} else {
_json[r'file'] = null;
} }
_json[r'files'] = files; _json[r'files'] = files;
return _json; return _json;

View File

@ -40,6 +40,8 @@ class FooGetDefaultResponse {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (string != null) { if (string != null) {
_json[r'string'] = string; _json[r'string'] = string;
} else {
_json[r'string'] = null;
} }
return _json; return _json;
} }

View File

@ -193,43 +193,67 @@ class FormatTest {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (integer != null) { if (integer != null) {
_json[r'integer'] = integer; _json[r'integer'] = integer;
} else {
_json[r'integer'] = null;
} }
if (int32 != null) { if (int32 != null) {
_json[r'int32'] = int32; _json[r'int32'] = int32;
} else {
_json[r'int32'] = null;
} }
if (int64 != null) { if (int64 != null) {
_json[r'int64'] = int64; _json[r'int64'] = int64;
} else {
_json[r'int64'] = null;
} }
_json[r'number'] = number; _json[r'number'] = number;
if (float != null) { if (float != null) {
_json[r'float'] = float; _json[r'float'] = float;
} else {
_json[r'float'] = null;
} }
if (double_ != null) { if (double_ != null) {
_json[r'double'] = double_; _json[r'double'] = double_;
} else {
_json[r'double'] = null;
} }
if (decimal != null) { if (decimal != null) {
_json[r'decimal'] = decimal; _json[r'decimal'] = decimal;
} else {
_json[r'decimal'] = null;
} }
if (string != null) { if (string != null) {
_json[r'string'] = string; _json[r'string'] = string;
} else {
_json[r'string'] = null;
} }
_json[r'byte'] = byte; _json[r'byte'] = byte;
if (binary != null) { if (binary != null) {
_json[r'binary'] = binary; _json[r'binary'] = binary;
} else {
_json[r'binary'] = null;
} }
_json[r'date'] = _dateFormatter.format(date.toUtc()); _json[r'date'] = _dateFormatter.format(date.toUtc());
if (dateTime != null) { if (dateTime != null) {
_json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); _json[r'dateTime'] = dateTime!.toUtc().toIso8601String();
} else {
_json[r'dateTime'] = null;
} }
if (uuid != null) { if (uuid != null) {
_json[r'uuid'] = uuid; _json[r'uuid'] = uuid;
} else {
_json[r'uuid'] = null;
} }
_json[r'password'] = password; _json[r'password'] = password;
if (patternWithDigits != null) { if (patternWithDigits != null) {
_json[r'pattern_with_digits'] = patternWithDigits; _json[r'pattern_with_digits'] = patternWithDigits;
} else {
_json[r'pattern_with_digits'] = null;
} }
if (patternWithDigitsAndDelimiter != null) { if (patternWithDigitsAndDelimiter != null) {
_json[r'pattern_with_digits_and_delimiter'] = patternWithDigitsAndDelimiter; _json[r'pattern_with_digits_and_delimiter'] = patternWithDigitsAndDelimiter;
} else {
_json[r'pattern_with_digits_and_delimiter'] = null;
} }
return _json; return _json;
} }

View File

@ -51,9 +51,13 @@ class HasOnlyReadOnly {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (bar != null) { if (bar != null) {
_json[r'bar'] = bar; _json[r'bar'] = bar;
} else {
_json[r'bar'] = null;
} }
if (foo != null) { if (foo != null) {
_json[r'foo'] = foo; _json[r'foo'] = foo;
} else {
_json[r'foo'] = null;
} }
return _json; return _json;
} }

View File

@ -34,6 +34,8 @@ class HealthCheckResult {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (nullableMessage != null) { if (nullableMessage != null) {
_json[r'NullableMessage'] = nullableMessage; _json[r'NullableMessage'] = nullableMessage;
} else {
_json[r'NullableMessage'] = null;
} }
return _json; return _json;
} }

View File

@ -56,9 +56,13 @@ class MixedPropertiesAndAdditionalPropertiesClass {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (uuid != null) { if (uuid != null) {
_json[r'uuid'] = uuid; _json[r'uuid'] = uuid;
} else {
_json[r'uuid'] = null;
} }
if (dateTime != null) { if (dateTime != null) {
_json[r'dateTime'] = dateTime!.toUtc().toIso8601String(); _json[r'dateTime'] = dateTime!.toUtc().toIso8601String();
} else {
_json[r'dateTime'] = null;
} }
_json[r'map'] = map; _json[r'map'] = map;
return _json; return _json;

View File

@ -51,9 +51,13 @@ class Model200Response {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (name != null) { if (name != null) {
_json[r'name'] = name; _json[r'name'] = name;
} else {
_json[r'name'] = null;
} }
if (class_ != null) { if (class_ != null) {
_json[r'class'] = class_; _json[r'class'] = class_;
} else {
_json[r'class'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class ModelClient {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (client != null) { if (client != null) {
_json[r'client'] = client; _json[r'client'] = client;
} else {
_json[r'client'] = null;
} }
return _json; return _json;
} }

View File

@ -41,6 +41,8 @@ class ModelFile {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (sourceURI != null) { if (sourceURI != null) {
_json[r'sourceURI'] = sourceURI; _json[r'sourceURI'] = sourceURI;
} else {
_json[r'sourceURI'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class ModelList {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (n123list != null) { if (n123list != null) {
_json[r'123-list'] = n123list; _json[r'123-list'] = n123list;
} else {
_json[r'123-list'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class ModelReturn {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (return_ != null) { if (return_ != null) {
_json[r'return'] = return_; _json[r'return'] = return_;
} else {
_json[r'return'] = null;
} }
return _json; return _json;
} }

View File

@ -68,12 +68,18 @@ class Name {
_json[r'name'] = name; _json[r'name'] = name;
if (snakeCase != null) { if (snakeCase != null) {
_json[r'snake_case'] = snakeCase; _json[r'snake_case'] = snakeCase;
} else {
_json[r'snake_case'] = null;
} }
if (property != null) { if (property != null) {
_json[r'property'] = property; _json[r'property'] = property;
} else {
_json[r'property'] = null;
} }
if (n123number != null) { if (n123number != null) {
_json[r'123Number'] = n123number; _json[r'123Number'] = n123number;
} else {
_json[r'123Number'] = null;
} }
return _json; return _json;
} }

View File

@ -89,34 +89,54 @@ class NullableClass {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (integerProp != null) { if (integerProp != null) {
_json[r'integer_prop'] = integerProp; _json[r'integer_prop'] = integerProp;
} else {
_json[r'integer_prop'] = null;
} }
if (numberProp != null) { if (numberProp != null) {
_json[r'number_prop'] = numberProp; _json[r'number_prop'] = numberProp;
} else {
_json[r'number_prop'] = null;
} }
if (booleanProp != null) { if (booleanProp != null) {
_json[r'boolean_prop'] = booleanProp; _json[r'boolean_prop'] = booleanProp;
} else {
_json[r'boolean_prop'] = null;
} }
if (stringProp != null) { if (stringProp != null) {
_json[r'string_prop'] = stringProp; _json[r'string_prop'] = stringProp;
} else {
_json[r'string_prop'] = null;
} }
if (dateProp != null) { if (dateProp != null) {
_json[r'date_prop'] = _dateFormatter.format(dateProp!.toUtc()); _json[r'date_prop'] = _dateFormatter.format(dateProp!.toUtc());
} else {
_json[r'date_prop'] = null;
} }
if (datetimeProp != null) { if (datetimeProp != null) {
_json[r'datetime_prop'] = datetimeProp!.toUtc().toIso8601String(); _json[r'datetime_prop'] = datetimeProp!.toUtc().toIso8601String();
} else {
_json[r'datetime_prop'] = null;
} }
if (arrayNullableProp != null) { if (arrayNullableProp != null) {
_json[r'array_nullable_prop'] = arrayNullableProp; _json[r'array_nullable_prop'] = arrayNullableProp;
} else {
_json[r'array_nullable_prop'] = null;
} }
if (arrayAndItemsNullableProp != null) { if (arrayAndItemsNullableProp != null) {
_json[r'array_and_items_nullable_prop'] = arrayAndItemsNullableProp; _json[r'array_and_items_nullable_prop'] = arrayAndItemsNullableProp;
} else {
_json[r'array_and_items_nullable_prop'] = null;
} }
_json[r'array_items_nullable'] = arrayItemsNullable; _json[r'array_items_nullable'] = arrayItemsNullable;
if (objectNullableProp != null) { if (objectNullableProp != null) {
_json[r'object_nullable_prop'] = objectNullableProp; _json[r'object_nullable_prop'] = objectNullableProp;
} else {
_json[r'object_nullable_prop'] = null;
} }
if (objectAndItemsNullableProp != null) { if (objectAndItemsNullableProp != null) {
_json[r'object_and_items_nullable_prop'] = objectAndItemsNullableProp; _json[r'object_and_items_nullable_prop'] = objectAndItemsNullableProp;
} else {
_json[r'object_and_items_nullable_prop'] = null;
} }
_json[r'object_items_nullable'] = objectItemsNullable; _json[r'object_items_nullable'] = objectItemsNullable;
return _json; return _json;

View File

@ -40,6 +40,8 @@ class NumberOnly {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (justNumber != null) { if (justNumber != null) {
_json[r'JustNumber'] = justNumber; _json[r'JustNumber'] = justNumber;
} else {
_json[r'JustNumber'] = null;
} }
return _json; return _json;
} }

View File

@ -67,12 +67,18 @@ class ObjectWithDeprecatedFields {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (uuid != null) { if (uuid != null) {
_json[r'uuid'] = uuid; _json[r'uuid'] = uuid;
} else {
_json[r'uuid'] = null;
} }
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (deprecatedRef != null) { if (deprecatedRef != null) {
_json[r'deprecatedRef'] = deprecatedRef; _json[r'deprecatedRef'] = deprecatedRef;
} else {
_json[r'deprecatedRef'] = null;
} }
_json[r'bars'] = bars; _json[r'bars'] = bars;
return _json; return _json;

View File

@ -84,18 +84,28 @@ class Order {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (petId != null) { if (petId != null) {
_json[r'petId'] = petId; _json[r'petId'] = petId;
} else {
_json[r'petId'] = null;
} }
if (quantity != null) { if (quantity != null) {
_json[r'quantity'] = quantity; _json[r'quantity'] = quantity;
} else {
_json[r'quantity'] = null;
} }
if (shipDate != null) { if (shipDate != null) {
_json[r'shipDate'] = shipDate!.toUtc().toIso8601String(); _json[r'shipDate'] = shipDate!.toUtc().toIso8601String();
} else {
_json[r'shipDate'] = null;
} }
if (status != null) { if (status != null) {
_json[r'status'] = status; _json[r'status'] = status;
} else {
_json[r'status'] = null;
} }
_json[r'complete'] = complete; _json[r'complete'] = complete;
return _json; return _json;

View File

@ -62,12 +62,18 @@ class OuterComposite {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (myNumber != null) { if (myNumber != null) {
_json[r'my_number'] = myNumber; _json[r'my_number'] = myNumber;
} else {
_json[r'my_number'] = null;
} }
if (myString != null) { if (myString != null) {
_json[r'my_string'] = myString; _json[r'my_string'] = myString;
} else {
_json[r'my_string'] = null;
} }
if (myBoolean != null) { if (myBoolean != null) {
_json[r'my_boolean'] = myBoolean; _json[r'my_boolean'] = myBoolean;
} else {
_json[r'my_boolean'] = null;
} }
return _json; return _json;
} }

View File

@ -72,15 +72,21 @@ class Pet {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (category != null) { if (category != null) {
_json[r'category'] = category; _json[r'category'] = category;
} else {
_json[r'category'] = null;
} }
_json[r'name'] = name; _json[r'name'] = name;
_json[r'photoUrls'] = photoUrls; _json[r'photoUrls'] = photoUrls;
_json[r'tags'] = tags; _json[r'tags'] = tags;
if (status != null) { if (status != null) {
_json[r'status'] = status; _json[r'status'] = status;
} else {
_json[r'status'] = null;
} }
return _json; return _json;
} }

View File

@ -51,9 +51,13 @@ class ReadOnlyFirst {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (bar != null) { if (bar != null) {
_json[r'bar'] = bar; _json[r'bar'] = bar;
} else {
_json[r'bar'] = null;
} }
if (baz != null) { if (baz != null) {
_json[r'baz'] = baz; _json[r'baz'] = baz;
} else {
_json[r'baz'] = null;
} }
return _json; return _json;
} }

View File

@ -40,6 +40,8 @@ class SpecialModelName {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { if (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) {
_json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; _json[r'$special[property.name]'] = dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket;
} else {
_json[r'$special[property.name]'] = null;
} }
return _json; return _json;
} }

View File

@ -51,9 +51,13 @@ class Tag {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (name != null) { if (name != null) {
_json[r'name'] = name; _json[r'name'] = name;
} else {
_json[r'name'] = null;
} }
return _json; return _json;
} }

View File

@ -118,27 +118,43 @@ class User {
final _json = <String, dynamic>{}; final _json = <String, dynamic>{};
if (id != null) { if (id != null) {
_json[r'id'] = id; _json[r'id'] = id;
} else {
_json[r'id'] = null;
} }
if (username != null) { if (username != null) {
_json[r'username'] = username; _json[r'username'] = username;
} else {
_json[r'username'] = null;
} }
if (firstName != null) { if (firstName != null) {
_json[r'firstName'] = firstName; _json[r'firstName'] = firstName;
} else {
_json[r'firstName'] = null;
} }
if (lastName != null) { if (lastName != null) {
_json[r'lastName'] = lastName; _json[r'lastName'] = lastName;
} else {
_json[r'lastName'] = null;
} }
if (email != null) { if (email != null) {
_json[r'email'] = email; _json[r'email'] = email;
} else {
_json[r'email'] = null;
} }
if (password != null) { if (password != null) {
_json[r'password'] = password; _json[r'password'] = password;
} else {
_json[r'password'] = null;
} }
if (phone != null) { if (phone != null) {
_json[r'phone'] = phone; _json[r'phone'] = phone;
} else {
_json[r'phone'] = null;
} }
if (userStatus != null) { if (userStatus != null) {
_json[r'userStatus'] = userStatus; _json[r'userStatus'] = userStatus;
} else {
_json[r'userStatus'] = null;
} }
return _json; return _json;
} }