forked from loafle/openapi-generator-original
[Dart] Avoid redundant null checking in fromJson (#3632)
* Move dart null checks inside mustache type checks - removed surrounding null check - added a conditional expression to each case except the redundant one * Run shell scripts so CIs can verify the change
This commit is contained in:
parent
15f680e1eb
commit
a05f68431a
@ -16,51 +16,63 @@ class {{classname}} {
|
||||
{{classname}}.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
{{#vars}}
|
||||
if (json['{{baseName}}'] == null) {
|
||||
{{name}} = null;
|
||||
} else {
|
||||
{{#isDateTime}}
|
||||
{{name}} = DateTime.parse(json['{{baseName}}']);
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
DateTime.parse(json['{{baseName}}']);
|
||||
{{/isDateTime}}
|
||||
{{#isDate}}
|
||||
{{name}} = DateTime.parse(json['{{baseName}}']);
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
DateTime.parse(json['{{baseName}}']);
|
||||
{{/isDate}}
|
||||
{{^isDateTime}}
|
||||
{{^isDate}}
|
||||
{{#complexType}}
|
||||
{{#isListContainer}}
|
||||
{{name}} = {{complexType}}.listFromJson(json['{{baseName}}']);
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
{{complexType}}.listFromJson(json['{{baseName}}']);
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
{{name}} = {{complexType}}.mapFromJson(json['{{baseName}}']);
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
{{complexType}}.mapFromJson(json['{{baseName}}']);
|
||||
{{/isMapContainer}}
|
||||
{{^isMapContainer}}
|
||||
{{name}} = {{complexType}}.fromJson(json['{{baseName}}']);
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
{{complexType}}.fromJson(json['{{baseName}}']);
|
||||
{{/isMapContainer}}
|
||||
{{/isListContainer}}
|
||||
{{/complexType}}
|
||||
{{^complexType}}
|
||||
{{#isListContainer}}
|
||||
{{name}} = (json['{{baseName}}'] as List).cast<{{items.datatype}}>();
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
(json['{{baseName}}'] as List).cast<{{items.datatype}}>();
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
{{#isMapContainer}}
|
||||
{{name}} = (json['{{baseName}}'] as Map).cast<String, {{items.datatype}}>();
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
(json['{{baseName}}'] as Map).cast<String, {{items.datatype}}>();
|
||||
{{/isMapContainer}}
|
||||
{{^isMapContainer}}
|
||||
{{#isDouble}}
|
||||
{{name}} = json['{{baseName}}'].toDouble();
|
||||
{{/isDouble}}
|
||||
{{^isDouble}}
|
||||
{{name}} = json['{{baseName}}'];
|
||||
{{/isDouble}}
|
||||
{{#isDouble}}
|
||||
{{name}} = (json['{{baseName}}'] == null) ?
|
||||
null :
|
||||
json['{{baseName}}'].toDouble();
|
||||
{{/isDouble}}
|
||||
{{^isDouble}}
|
||||
{{name}} = json['{{baseName}}'];
|
||||
{{/isDouble}}
|
||||
{{/isMapContainer}}
|
||||
{{/isListContainer}}
|
||||
{{/complexType}}
|
||||
{{/isDate}}
|
||||
{{/isDateTime}}
|
||||
}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@ part of openapi.api;
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
int code = null;
|
||||
int code = null;
|
||||
|
||||
String type = null;
|
||||
String type = null;
|
||||
|
||||
String message = null;
|
||||
String message = null;
|
||||
ApiResponse();
|
||||
|
||||
@override
|
||||
@ -16,21 +16,9 @@ class ApiResponse {
|
||||
|
||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['code'] == null) {
|
||||
code = null;
|
||||
} else {
|
||||
code = json['code'];
|
||||
}
|
||||
if (json['type'] == null) {
|
||||
type = null;
|
||||
} else {
|
||||
type = json['type'];
|
||||
}
|
||||
if (json['message'] == null) {
|
||||
message = null;
|
||||
} else {
|
||||
message = json['message'];
|
||||
}
|
||||
code = json['code'];
|
||||
type = json['type'];
|
||||
message = json['message'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Category {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Category();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Category {
|
||||
|
||||
Category.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class InlineObject {
|
||||
/* Updated name of the pet */
|
||||
String name = null;
|
||||
String name = null;
|
||||
/* Updated status of the pet */
|
||||
String status = null;
|
||||
String status = null;
|
||||
InlineObject();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class InlineObject {
|
||||
|
||||
InlineObject.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
name = json['name'];
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class InlineObject1 {
|
||||
/* Additional data to pass to server */
|
||||
String additionalMetadata = null;
|
||||
String additionalMetadata = null;
|
||||
/* file to upload */
|
||||
MultipartFile file = null;
|
||||
MultipartFile file = null;
|
||||
InlineObject1();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,10 @@ class InlineObject1 {
|
||||
|
||||
InlineObject1.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['additionalMetadata'] == null) {
|
||||
additionalMetadata = null;
|
||||
} else {
|
||||
additionalMetadata = json['additionalMetadata'];
|
||||
}
|
||||
if (json['file'] == null) {
|
||||
file = null;
|
||||
} else {
|
||||
file = File.fromJson(json['file']);
|
||||
}
|
||||
additionalMetadata = json['additionalMetadata'];
|
||||
file = (json['file'] == null) ?
|
||||
null :
|
||||
File.fromJson(json['file']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,18 +2,18 @@ part of openapi.api;
|
||||
|
||||
class Order {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
int petId = null;
|
||||
int petId = null;
|
||||
|
||||
int quantity = null;
|
||||
int quantity = null;
|
||||
|
||||
DateTime shipDate = null;
|
||||
DateTime shipDate = null;
|
||||
/* Order Status */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { placed, approved, delivered, };{
|
||||
|
||||
bool complete = false;
|
||||
bool complete = false;
|
||||
Order();
|
||||
|
||||
@override
|
||||
@ -23,36 +23,14 @@ class Order {
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['petId'] == null) {
|
||||
petId = null;
|
||||
} else {
|
||||
petId = json['petId'];
|
||||
}
|
||||
if (json['quantity'] == null) {
|
||||
quantity = null;
|
||||
} else {
|
||||
quantity = json['quantity'];
|
||||
}
|
||||
if (json['shipDate'] == null) {
|
||||
shipDate = null;
|
||||
} else {
|
||||
shipDate = DateTime.parse(json['shipDate']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
if (json['complete'] == null) {
|
||||
complete = null;
|
||||
} else {
|
||||
complete = json['complete'];
|
||||
}
|
||||
id = json['id'];
|
||||
petId = json['petId'];
|
||||
quantity = json['quantity'];
|
||||
shipDate = (json['shipDate'] == null) ?
|
||||
null :
|
||||
DateTime.parse(json['shipDate']);
|
||||
status = json['status'];
|
||||
complete = json['complete'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,17 +2,17 @@ part of openapi.api;
|
||||
|
||||
class Pet {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
Category category = null;
|
||||
Category category = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
|
||||
List<String> photoUrls = [];
|
||||
List<String> photoUrls = [];
|
||||
|
||||
List<Tag> tags = [];
|
||||
List<Tag> tags = [];
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };{
|
||||
Pet();
|
||||
|
||||
@ -23,36 +23,18 @@ class Pet {
|
||||
|
||||
Pet.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['category'] == null) {
|
||||
category = null;
|
||||
} else {
|
||||
category = new Category.fromJson(json['category']);
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
if (json['photoUrls'] == null) {
|
||||
photoUrls = null;
|
||||
} else {
|
||||
photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList();
|
||||
}
|
||||
if (json['tags'] == null) {
|
||||
tags = null;
|
||||
} else {
|
||||
tags = Tag.listFromJson(json['tags']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
id = json['id'];
|
||||
category = (json['category'] == null) ?
|
||||
null :
|
||||
Category.fromJson(json['category']);
|
||||
name = json['name'];
|
||||
photoUrls = (json['photoUrls'] == null) ?
|
||||
null :
|
||||
(json['photoUrls'] as List).cast<String>();
|
||||
tags = (json['tags'] == null) ?
|
||||
null :
|
||||
Tag.listFromJson(json['tags']);
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Tag {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Tag();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Tag {
|
||||
|
||||
Tag.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,21 +2,21 @@ part of openapi.api;
|
||||
|
||||
class User {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String username = null;
|
||||
String username = null;
|
||||
|
||||
String firstName = null;
|
||||
String firstName = null;
|
||||
|
||||
String lastName = null;
|
||||
String lastName = null;
|
||||
|
||||
String email = null;
|
||||
String email = null;
|
||||
|
||||
String password = null;
|
||||
String password = null;
|
||||
|
||||
String phone = null;
|
||||
String phone = null;
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
int userStatus = null;
|
||||
User();
|
||||
|
||||
@override
|
||||
@ -26,46 +26,14 @@ class User {
|
||||
|
||||
User.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['username'] == null) {
|
||||
username = null;
|
||||
} else {
|
||||
username = json['username'];
|
||||
}
|
||||
if (json['firstName'] == null) {
|
||||
firstName = null;
|
||||
} else {
|
||||
firstName = json['firstName'];
|
||||
}
|
||||
if (json['lastName'] == null) {
|
||||
lastName = null;
|
||||
} else {
|
||||
lastName = json['lastName'];
|
||||
}
|
||||
if (json['email'] == null) {
|
||||
email = null;
|
||||
} else {
|
||||
email = json['email'];
|
||||
}
|
||||
if (json['password'] == null) {
|
||||
password = null;
|
||||
} else {
|
||||
password = json['password'];
|
||||
}
|
||||
if (json['phone'] == null) {
|
||||
phone = null;
|
||||
} else {
|
||||
phone = json['phone'];
|
||||
}
|
||||
if (json['userStatus'] == null) {
|
||||
userStatus = null;
|
||||
} else {
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
id = json['id'];
|
||||
username = json['username'];
|
||||
firstName = json['firstName'];
|
||||
lastName = json['lastName'];
|
||||
email = json['email'];
|
||||
password = json['password'];
|
||||
phone = json['phone'];
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,11 +2,11 @@ part of openapi.api;
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
int code = null;
|
||||
int code = null;
|
||||
|
||||
String type = null;
|
||||
String type = null;
|
||||
|
||||
String message = null;
|
||||
String message = null;
|
||||
ApiResponse();
|
||||
|
||||
@override
|
||||
@ -16,21 +16,9 @@ class ApiResponse {
|
||||
|
||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['code'] == null) {
|
||||
code = null;
|
||||
} else {
|
||||
code = json['code'];
|
||||
}
|
||||
if (json['type'] == null) {
|
||||
type = null;
|
||||
} else {
|
||||
type = json['type'];
|
||||
}
|
||||
if (json['message'] == null) {
|
||||
message = null;
|
||||
} else {
|
||||
message = json['message'];
|
||||
}
|
||||
code = json['code'];
|
||||
type = json['type'];
|
||||
message = json['message'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Category {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Category();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Category {
|
||||
|
||||
Category.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,18 +2,18 @@ part of openapi.api;
|
||||
|
||||
class Order {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
int petId = null;
|
||||
int petId = null;
|
||||
|
||||
int quantity = null;
|
||||
int quantity = null;
|
||||
|
||||
DateTime shipDate = null;
|
||||
DateTime shipDate = null;
|
||||
/* Order Status */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { placed, approved, delivered, };{
|
||||
|
||||
bool complete = false;
|
||||
bool complete = false;
|
||||
Order();
|
||||
|
||||
@override
|
||||
@ -23,36 +23,14 @@ class Order {
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['petId'] == null) {
|
||||
petId = null;
|
||||
} else {
|
||||
petId = json['petId'];
|
||||
}
|
||||
if (json['quantity'] == null) {
|
||||
quantity = null;
|
||||
} else {
|
||||
quantity = json['quantity'];
|
||||
}
|
||||
if (json['shipDate'] == null) {
|
||||
shipDate = null;
|
||||
} else {
|
||||
shipDate = DateTime.parse(json['shipDate']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
if (json['complete'] == null) {
|
||||
complete = null;
|
||||
} else {
|
||||
complete = json['complete'];
|
||||
}
|
||||
id = json['id'];
|
||||
petId = json['petId'];
|
||||
quantity = json['quantity'];
|
||||
shipDate = (json['shipDate'] == null) ?
|
||||
null :
|
||||
DateTime.parse(json['shipDate']);
|
||||
status = json['status'];
|
||||
complete = json['complete'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,17 +2,17 @@ part of openapi.api;
|
||||
|
||||
class Pet {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
Category category = null;
|
||||
Category category = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
|
||||
List<String> photoUrls = [];
|
||||
List<String> photoUrls = [];
|
||||
|
||||
List<Tag> tags = [];
|
||||
List<Tag> tags = [];
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };{
|
||||
Pet();
|
||||
|
||||
@ -23,36 +23,18 @@ class Pet {
|
||||
|
||||
Pet.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['category'] == null) {
|
||||
category = null;
|
||||
} else {
|
||||
category = Category.fromJson(json['category']);
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
if (json['photoUrls'] == null) {
|
||||
photoUrls = null;
|
||||
} else {
|
||||
photoUrls = (json['photoUrls'] as List).cast<String>();
|
||||
}
|
||||
if (json['tags'] == null) {
|
||||
tags = null;
|
||||
} else {
|
||||
tags = Tag.listFromJson(json['tags']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
id = json['id'];
|
||||
category = (json['category'] == null) ?
|
||||
null :
|
||||
Category.fromJson(json['category']);
|
||||
name = json['name'];
|
||||
photoUrls = (json['photoUrls'] == null) ?
|
||||
null :
|
||||
(json['photoUrls'] as List).cast<String>();
|
||||
tags = (json['tags'] == null) ?
|
||||
null :
|
||||
Tag.listFromJson(json['tags']);
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Tag {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Tag();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Tag {
|
||||
|
||||
Tag.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,21 +2,21 @@ part of openapi.api;
|
||||
|
||||
class User {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String username = null;
|
||||
String username = null;
|
||||
|
||||
String firstName = null;
|
||||
String firstName = null;
|
||||
|
||||
String lastName = null;
|
||||
String lastName = null;
|
||||
|
||||
String email = null;
|
||||
String email = null;
|
||||
|
||||
String password = null;
|
||||
String password = null;
|
||||
|
||||
String phone = null;
|
||||
String phone = null;
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
int userStatus = null;
|
||||
User();
|
||||
|
||||
@override
|
||||
@ -26,46 +26,14 @@ class User {
|
||||
|
||||
User.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['username'] == null) {
|
||||
username = null;
|
||||
} else {
|
||||
username = json['username'];
|
||||
}
|
||||
if (json['firstName'] == null) {
|
||||
firstName = null;
|
||||
} else {
|
||||
firstName = json['firstName'];
|
||||
}
|
||||
if (json['lastName'] == null) {
|
||||
lastName = null;
|
||||
} else {
|
||||
lastName = json['lastName'];
|
||||
}
|
||||
if (json['email'] == null) {
|
||||
email = null;
|
||||
} else {
|
||||
email = json['email'];
|
||||
}
|
||||
if (json['password'] == null) {
|
||||
password = null;
|
||||
} else {
|
||||
password = json['password'];
|
||||
}
|
||||
if (json['phone'] == null) {
|
||||
phone = null;
|
||||
} else {
|
||||
phone = json['phone'];
|
||||
}
|
||||
if (json['userStatus'] == null) {
|
||||
userStatus = null;
|
||||
} else {
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
id = json['id'];
|
||||
username = json['username'];
|
||||
firstName = json['firstName'];
|
||||
lastName = json['lastName'];
|
||||
email = json['email'];
|
||||
password = json['password'];
|
||||
phone = json['phone'];
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,11 +2,11 @@ part of openapi.api;
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
int code = null;
|
||||
int code = null;
|
||||
|
||||
String type = null;
|
||||
String type = null;
|
||||
|
||||
String message = null;
|
||||
String message = null;
|
||||
ApiResponse();
|
||||
|
||||
@override
|
||||
@ -16,21 +16,9 @@ class ApiResponse {
|
||||
|
||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['code'] == null) {
|
||||
code = null;
|
||||
} else {
|
||||
code = json['code'];
|
||||
}
|
||||
if (json['type'] == null) {
|
||||
type = null;
|
||||
} else {
|
||||
type = json['type'];
|
||||
}
|
||||
if (json['message'] == null) {
|
||||
message = null;
|
||||
} else {
|
||||
message = json['message'];
|
||||
}
|
||||
code = json['code'];
|
||||
type = json['type'];
|
||||
message = json['message'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Category {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Category();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Category {
|
||||
|
||||
Category.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,18 +2,18 @@ part of openapi.api;
|
||||
|
||||
class Order {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
int petId = null;
|
||||
int petId = null;
|
||||
|
||||
int quantity = null;
|
||||
int quantity = null;
|
||||
|
||||
DateTime shipDate = null;
|
||||
DateTime shipDate = null;
|
||||
/* Order Status */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { placed, approved, delivered, };{
|
||||
|
||||
bool complete = false;
|
||||
bool complete = false;
|
||||
Order();
|
||||
|
||||
@override
|
||||
@ -23,36 +23,14 @@ class Order {
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['petId'] == null) {
|
||||
petId = null;
|
||||
} else {
|
||||
petId = json['petId'];
|
||||
}
|
||||
if (json['quantity'] == null) {
|
||||
quantity = null;
|
||||
} else {
|
||||
quantity = json['quantity'];
|
||||
}
|
||||
if (json['shipDate'] == null) {
|
||||
shipDate = null;
|
||||
} else {
|
||||
shipDate = DateTime.parse(json['shipDate']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
if (json['complete'] == null) {
|
||||
complete = null;
|
||||
} else {
|
||||
complete = json['complete'];
|
||||
}
|
||||
id = json['id'];
|
||||
petId = json['petId'];
|
||||
quantity = json['quantity'];
|
||||
shipDate = (json['shipDate'] == null) ?
|
||||
null :
|
||||
DateTime.parse(json['shipDate']);
|
||||
status = json['status'];
|
||||
complete = json['complete'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,17 +2,17 @@ part of openapi.api;
|
||||
|
||||
class Pet {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
Category category = null;
|
||||
Category category = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
|
||||
List<String> photoUrls = [];
|
||||
List<String> photoUrls = [];
|
||||
|
||||
List<Tag> tags = [];
|
||||
List<Tag> tags = [];
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };{
|
||||
Pet();
|
||||
|
||||
@ -23,36 +23,18 @@ class Pet {
|
||||
|
||||
Pet.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['category'] == null) {
|
||||
category = null;
|
||||
} else {
|
||||
category = Category.fromJson(json['category']);
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
if (json['photoUrls'] == null) {
|
||||
photoUrls = null;
|
||||
} else {
|
||||
photoUrls = (json['photoUrls'] as List).cast<String>();
|
||||
}
|
||||
if (json['tags'] == null) {
|
||||
tags = null;
|
||||
} else {
|
||||
tags = Tag.listFromJson(json['tags']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
id = json['id'];
|
||||
category = (json['category'] == null) ?
|
||||
null :
|
||||
Category.fromJson(json['category']);
|
||||
name = json['name'];
|
||||
photoUrls = (json['photoUrls'] == null) ?
|
||||
null :
|
||||
(json['photoUrls'] as List).cast<String>();
|
||||
tags = (json['tags'] == null) ?
|
||||
null :
|
||||
Tag.listFromJson(json['tags']);
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Tag {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Tag();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Tag {
|
||||
|
||||
Tag.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,21 +2,21 @@ part of openapi.api;
|
||||
|
||||
class User {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String username = null;
|
||||
String username = null;
|
||||
|
||||
String firstName = null;
|
||||
String firstName = null;
|
||||
|
||||
String lastName = null;
|
||||
String lastName = null;
|
||||
|
||||
String email = null;
|
||||
String email = null;
|
||||
|
||||
String password = null;
|
||||
String password = null;
|
||||
|
||||
String phone = null;
|
||||
String phone = null;
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
int userStatus = null;
|
||||
User();
|
||||
|
||||
@override
|
||||
@ -26,46 +26,14 @@ class User {
|
||||
|
||||
User.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['username'] == null) {
|
||||
username = null;
|
||||
} else {
|
||||
username = json['username'];
|
||||
}
|
||||
if (json['firstName'] == null) {
|
||||
firstName = null;
|
||||
} else {
|
||||
firstName = json['firstName'];
|
||||
}
|
||||
if (json['lastName'] == null) {
|
||||
lastName = null;
|
||||
} else {
|
||||
lastName = json['lastName'];
|
||||
}
|
||||
if (json['email'] == null) {
|
||||
email = null;
|
||||
} else {
|
||||
email = json['email'];
|
||||
}
|
||||
if (json['password'] == null) {
|
||||
password = null;
|
||||
} else {
|
||||
password = json['password'];
|
||||
}
|
||||
if (json['phone'] == null) {
|
||||
phone = null;
|
||||
} else {
|
||||
phone = json['phone'];
|
||||
}
|
||||
if (json['userStatus'] == null) {
|
||||
userStatus = null;
|
||||
} else {
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
id = json['id'];
|
||||
username = json['username'];
|
||||
firstName = json['firstName'];
|
||||
lastName = json['lastName'];
|
||||
email = json['email'];
|
||||
password = json['password'];
|
||||
phone = json['phone'];
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,11 +2,11 @@ part of openapi.api;
|
||||
|
||||
class ApiResponse {
|
||||
|
||||
int code = null;
|
||||
int code = null;
|
||||
|
||||
String type = null;
|
||||
String type = null;
|
||||
|
||||
String message = null;
|
||||
String message = null;
|
||||
ApiResponse();
|
||||
|
||||
@override
|
||||
@ -16,21 +16,9 @@ class ApiResponse {
|
||||
|
||||
ApiResponse.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['code'] == null) {
|
||||
code = null;
|
||||
} else {
|
||||
code = json['code'];
|
||||
}
|
||||
if (json['type'] == null) {
|
||||
type = null;
|
||||
} else {
|
||||
type = json['type'];
|
||||
}
|
||||
if (json['message'] == null) {
|
||||
message = null;
|
||||
} else {
|
||||
message = json['message'];
|
||||
}
|
||||
code = json['code'];
|
||||
type = json['type'];
|
||||
message = json['message'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Category {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Category();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Category {
|
||||
|
||||
Category.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,18 +2,18 @@ part of openapi.api;
|
||||
|
||||
class Order {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
int petId = null;
|
||||
int petId = null;
|
||||
|
||||
int quantity = null;
|
||||
int quantity = null;
|
||||
|
||||
DateTime shipDate = null;
|
||||
DateTime shipDate = null;
|
||||
/* Order Status */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { placed, approved, delivered, };{
|
||||
|
||||
bool complete = false;
|
||||
bool complete = false;
|
||||
Order();
|
||||
|
||||
@override
|
||||
@ -23,36 +23,14 @@ class Order {
|
||||
|
||||
Order.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['petId'] == null) {
|
||||
petId = null;
|
||||
} else {
|
||||
petId = json['petId'];
|
||||
}
|
||||
if (json['quantity'] == null) {
|
||||
quantity = null;
|
||||
} else {
|
||||
quantity = json['quantity'];
|
||||
}
|
||||
if (json['shipDate'] == null) {
|
||||
shipDate = null;
|
||||
} else {
|
||||
shipDate = DateTime.parse(json['shipDate']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
if (json['complete'] == null) {
|
||||
complete = null;
|
||||
} else {
|
||||
complete = json['complete'];
|
||||
}
|
||||
id = json['id'];
|
||||
petId = json['petId'];
|
||||
quantity = json['quantity'];
|
||||
shipDate = (json['shipDate'] == null) ?
|
||||
null :
|
||||
DateTime.parse(json['shipDate']);
|
||||
status = json['status'];
|
||||
complete = json['complete'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,17 +2,17 @@ part of openapi.api;
|
||||
|
||||
class Pet {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
Category category = null;
|
||||
Category category = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
|
||||
List<String> photoUrls = [];
|
||||
List<String> photoUrls = [];
|
||||
|
||||
List<Tag> tags = [];
|
||||
List<Tag> tags = [];
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };{
|
||||
Pet();
|
||||
|
||||
@ -23,36 +23,18 @@ class Pet {
|
||||
|
||||
Pet.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['category'] == null) {
|
||||
category = null;
|
||||
} else {
|
||||
category = Category.fromJson(json['category']);
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
if (json['photoUrls'] == null) {
|
||||
photoUrls = null;
|
||||
} else {
|
||||
photoUrls = (json['photoUrls'] as List).cast<String>();
|
||||
}
|
||||
if (json['tags'] == null) {
|
||||
tags = null;
|
||||
} else {
|
||||
tags = Tag.listFromJson(json['tags']);
|
||||
}
|
||||
if (json['status'] == null) {
|
||||
status = null;
|
||||
} else {
|
||||
status = json['status'];
|
||||
}
|
||||
id = json['id'];
|
||||
category = (json['category'] == null) ?
|
||||
null :
|
||||
Category.fromJson(json['category']);
|
||||
name = json['name'];
|
||||
photoUrls = (json['photoUrls'] == null) ?
|
||||
null :
|
||||
(json['photoUrls'] as List).cast<String>();
|
||||
tags = (json['tags'] == null) ?
|
||||
null :
|
||||
Tag.listFromJson(json['tags']);
|
||||
status = json['status'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,9 +2,9 @@ part of openapi.api;
|
||||
|
||||
class Tag {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
String name = null;
|
||||
Tag();
|
||||
|
||||
@override
|
||||
@ -14,16 +14,8 @@ class Tag {
|
||||
|
||||
Tag.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['name'] == null) {
|
||||
name = null;
|
||||
} else {
|
||||
name = json['name'];
|
||||
}
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
@ -2,21 +2,21 @@ part of openapi.api;
|
||||
|
||||
class User {
|
||||
|
||||
int id = null;
|
||||
int id = null;
|
||||
|
||||
String username = null;
|
||||
String username = null;
|
||||
|
||||
String firstName = null;
|
||||
String firstName = null;
|
||||
|
||||
String lastName = null;
|
||||
String lastName = null;
|
||||
|
||||
String email = null;
|
||||
String email = null;
|
||||
|
||||
String password = null;
|
||||
String password = null;
|
||||
|
||||
String phone = null;
|
||||
String phone = null;
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
int userStatus = null;
|
||||
User();
|
||||
|
||||
@override
|
||||
@ -26,46 +26,14 @@ class User {
|
||||
|
||||
User.fromJson(Map<String, dynamic> json) {
|
||||
if (json == null) return;
|
||||
if (json['id'] == null) {
|
||||
id = null;
|
||||
} else {
|
||||
id = json['id'];
|
||||
}
|
||||
if (json['username'] == null) {
|
||||
username = null;
|
||||
} else {
|
||||
username = json['username'];
|
||||
}
|
||||
if (json['firstName'] == null) {
|
||||
firstName = null;
|
||||
} else {
|
||||
firstName = json['firstName'];
|
||||
}
|
||||
if (json['lastName'] == null) {
|
||||
lastName = null;
|
||||
} else {
|
||||
lastName = json['lastName'];
|
||||
}
|
||||
if (json['email'] == null) {
|
||||
email = null;
|
||||
} else {
|
||||
email = json['email'];
|
||||
}
|
||||
if (json['password'] == null) {
|
||||
password = null;
|
||||
} else {
|
||||
password = json['password'];
|
||||
}
|
||||
if (json['phone'] == null) {
|
||||
phone = null;
|
||||
} else {
|
||||
phone = json['phone'];
|
||||
}
|
||||
if (json['userStatus'] == null) {
|
||||
userStatus = null;
|
||||
} else {
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
id = json['id'];
|
||||
username = json['username'];
|
||||
firstName = json['firstName'];
|
||||
lastName = json['lastName'];
|
||||
email = json['email'];
|
||||
password = json['password'];
|
||||
phone = json['phone'];
|
||||
userStatus = json['userStatus'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user