Updated models

This commit is contained in:
Tobe O 2019-04-08 11:06:06 -04:00
parent f86c647360
commit 97e146a80e
11 changed files with 32 additions and 434 deletions

View file

@ -189,10 +189,6 @@ class Author extends _Author {
abstract class AuthorSerializer { abstract class AuthorSerializer {
static Author fromMap(Map map) { static Author fromMap(Map map) {
if (map['name'] == null) {
throw new FormatException("Missing required field 'name' on Author.");
}
return new Author( return new Author(
id: map['id'] as String, id: map['id'] as String,
name: map['name'] as String ?? 'Tobe Osakwe', name: map['name'] as String ?? 'Tobe Osakwe',
@ -212,10 +208,6 @@ abstract class AuthorSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.name == null) {
throw new FormatException("Missing required field 'name' on Author.");
}
return { return {
'id': model.id, 'id': model.id,
'name': model.name, 'name': model.name,

View file

@ -188,9 +188,9 @@ class BookQueryValues extends MapQueryValues {
class Book extends _Book { class Book extends _Book {
Book( Book(
{this.id, {this.id,
@required this.author, this.author,
@required this.partnerAuthor, this.partnerAuthor,
@required this.name, this.name,
this.createdAt, this.createdAt,
this.updatedAt}); this.updatedAt});
@ -254,19 +254,6 @@ class Book extends _Book {
abstract class BookSerializer { abstract class BookSerializer {
static Book fromMap(Map map) { static Book fromMap(Map map) {
if (map['author'] == null) {
throw new FormatException("Missing required field 'author' on Book.");
}
if (map['partner_author'] == null) {
throw new FormatException(
"Missing required field 'partner_author' on Book.");
}
if (map['name'] == null) {
throw new FormatException("Missing required field 'name' on Book.");
}
return new Book( return new Book(
id: map['id'] as String, id: map['id'] as String,
author: map['author'] != null author: map['author'] != null
@ -292,19 +279,6 @@ abstract class BookSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.author == null) {
throw new FormatException("Missing required field 'author' on Book.");
}
if (model.partnerAuthor == null) {
throw new FormatException(
"Missing required field 'partner_author' on Book.");
}
if (model.name == null) {
throw new FormatException("Missing required field 'name' on Book.");
}
return { return {
'id': model.id, 'id': model.id,
'author': AuthorSerializer.toMap(model.author), 'author': AuthorSerializer.toMap(model.author),

View file

@ -191,10 +191,10 @@ class CarQueryValues extends MapQueryValues {
class Car extends _Car { class Car extends _Car {
Car( Car(
{this.id, {this.id,
@required this.make, this.make,
@required this.description, this.description,
@required this.familyFriendly, this.familyFriendly,
@required this.recalledAt, this.recalledAt,
this.createdAt, this.createdAt,
this.updatedAt}); this.updatedAt});
@ -272,23 +272,6 @@ class Car extends _Car {
abstract class CarSerializer { abstract class CarSerializer {
static Car fromMap(Map map) { static Car fromMap(Map map) {
if (map['make'] == null) {
throw new FormatException("Missing required field 'make' on Car.");
}
if (map['description'] == null) {
throw new FormatException("Missing required field 'description' on Car.");
}
if (map['family_friendly'] == null) {
throw new FormatException(
"Missing required field 'family_friendly' on Car.");
}
if (map['recalled_at'] == null) {
throw new FormatException("Missing required field 'recalled_at' on Car.");
}
return new Car( return new Car(
id: map['id'] as String, id: map['id'] as String,
make: map['make'] as String, make: map['make'] as String,
@ -315,23 +298,6 @@ abstract class CarSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.make == null) {
throw new FormatException("Missing required field 'make' on Car.");
}
if (model.description == null) {
throw new FormatException("Missing required field 'description' on Car.");
}
if (model.familyFriendly == null) {
throw new FormatException(
"Missing required field 'family_friendly' on Car.");
}
if (model.recalledAt == null) {
throw new FormatException("Missing required field 'recalled_at' on Car.");
}
return { return {
'id': model.id, 'id': model.id,
'make': model.make, 'make': model.make,

View file

@ -151,12 +151,7 @@ class FootQueryValues extends MapQueryValues {
@generatedSerializable @generatedSerializable
class Foot extends _Foot { class Foot extends _Foot {
Foot( Foot({this.id, this.legId, this.nToes, this.createdAt, this.updatedAt});
{this.id,
@required this.legId,
@required this.nToes,
this.createdAt,
this.updatedAt});
@override @override
final String id; final String id;
@ -212,14 +207,6 @@ class Foot extends _Foot {
abstract class FootSerializer { abstract class FootSerializer {
static Foot fromMap(Map map) { static Foot fromMap(Map map) {
if (map['leg_id'] == null) {
throw new FormatException("Missing required field 'leg_id' on Foot.");
}
if (map['n_toes'] == null) {
throw new FormatException("Missing required field 'n_toes' on Foot.");
}
return new Foot( return new Foot(
id: map['id'] as String, id: map['id'] as String,
legId: map['leg_id'] as int, legId: map['leg_id'] as int,
@ -240,14 +227,6 @@ abstract class FootSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.legId == null) {
throw new FormatException("Missing required field 'leg_id' on Foot.");
}
if (model.nToes == null) {
throw new FormatException("Missing required field 'n_toes' on Foot.");
}
return { return {
'id': model.id, 'id': model.id,
'leg_id': model.legId, 'leg_id': model.legId,

View file

@ -152,11 +152,7 @@ class FruitQueryValues extends MapQueryValues {
@generatedSerializable @generatedSerializable
class Fruit extends _Fruit { class Fruit extends _Fruit {
Fruit( Fruit(
{this.id, {this.id, this.treeId, this.commonName, this.createdAt, this.updatedAt});
@required this.treeId,
@required this.commonName,
this.createdAt,
this.updatedAt});
@override @override
final String id; final String id;
@ -212,15 +208,6 @@ class Fruit extends _Fruit {
abstract class FruitSerializer { abstract class FruitSerializer {
static Fruit fromMap(Map map) { static Fruit fromMap(Map map) {
if (map['tree_id'] == null) {
throw new FormatException("Missing required field 'tree_id' on Fruit.");
}
if (map['common_name'] == null) {
throw new FormatException(
"Missing required field 'common_name' on Fruit.");
}
return new Fruit( return new Fruit(
id: map['id'] as String, id: map['id'] as String,
treeId: map['tree_id'] as int, treeId: map['tree_id'] as int,
@ -241,15 +228,6 @@ abstract class FruitSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.treeId == null) {
throw new FormatException("Missing required field 'tree_id' on Fruit.");
}
if (model.commonName == null) {
throw new FormatException(
"Missing required field 'common_name' on Fruit.");
}
return { return {
'id': model.id, 'id': model.id,
'tree_id': model.treeId, 'tree_id': model.treeId,

View file

@ -119,9 +119,7 @@ class HasMapQueryValues extends MapQueryValues {
@generatedSerializable @generatedSerializable
class HasMap implements _HasMap { class HasMap implements _HasMap {
const HasMap( const HasMap({Map<dynamic, dynamic> this.value, List<dynamic> this.list});
{@required Map<dynamic, dynamic> this.value,
@required List<dynamic> this.list});
@override @override
final Map<dynamic, dynamic> value; final Map<dynamic, dynamic> value;
@ -158,14 +156,6 @@ class HasMap implements _HasMap {
abstract class HasMapSerializer { abstract class HasMapSerializer {
static HasMap fromMap(Map map) { static HasMap fromMap(Map map) {
if (map['value'] == null) {
throw new FormatException("Missing required field 'value' on HasMap.");
}
if (map['list'] == null) {
throw new FormatException("Missing required field 'list' on HasMap.");
}
return new HasMap( return new HasMap(
value: map['value'] is Map value: map['value'] is Map
? (map['value'] as Map).cast<dynamic, dynamic>() ? (map['value'] as Map).cast<dynamic, dynamic>()
@ -179,14 +169,6 @@ abstract class HasMapSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.value == null) {
throw new FormatException("Missing required field 'value' on HasMap.");
}
if (model.list == null) {
throw new FormatException("Missing required field 'list' on HasMap.");
}
return {'value': model.value, 'list': model.list}; return {'value': model.value, 'list': model.list};
} }
} }

View file

@ -152,12 +152,7 @@ class LegQueryValues extends MapQueryValues {
@generatedSerializable @generatedSerializable
class Leg extends _Leg { class Leg extends _Leg {
Leg( Leg({this.id, this.foot, this.name, this.createdAt, this.updatedAt});
{this.id,
@required this.foot,
@required this.name,
this.createdAt,
this.updatedAt});
@override @override
final String id; final String id;
@ -213,14 +208,6 @@ class Leg extends _Leg {
abstract class LegSerializer { abstract class LegSerializer {
static Leg fromMap(Map map) { static Leg fromMap(Map map) {
if (map['foot'] == null) {
throw new FormatException("Missing required field 'foot' on Leg.");
}
if (map['name'] == null) {
throw new FormatException("Missing required field 'name' on Leg.");
}
return new Leg( return new Leg(
id: map['id'] as String, id: map['id'] as String,
foot: map['foot'] != null foot: map['foot'] != null
@ -243,14 +230,6 @@ abstract class LegSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.foot == null) {
throw new FormatException("Missing required field 'foot' on Leg.");
}
if (model.name == null) {
throw new FormatException("Missing required field 'name' on Leg.");
}
return { return {
'id': model.id, 'id': model.id,
'foot': FootSerializer.toMap(model.foot), 'foot': FootSerializer.toMap(model.foot),

View file

@ -199,10 +199,10 @@ class OrderQueryValues extends MapQueryValues {
class Order extends _Order { class Order extends _Order {
Order( Order(
{this.id, {this.id,
@required this.customer, this.customer,
@required this.employeeId, this.employeeId,
@required this.orderDate, this.orderDate,
@required this.shipperId, this.shipperId,
this.createdAt, this.createdAt,
this.updatedAt}); this.updatedAt});
@ -273,25 +273,6 @@ class Order extends _Order {
abstract class OrderSerializer { abstract class OrderSerializer {
static Order fromMap(Map map) { static Order fromMap(Map map) {
if (map['customer'] == null) {
throw new FormatException("Missing required field 'customer' on Order.");
}
if (map['employee_id'] == null) {
throw new FormatException(
"Missing required field 'employee_id' on Order.");
}
if (map['order_date'] == null) {
throw new FormatException(
"Missing required field 'order_date' on Order.");
}
if (map['shipper_id'] == null) {
throw new FormatException(
"Missing required field 'shipper_id' on Order.");
}
return new Order( return new Order(
id: map['id'] as String, id: map['id'] as String,
customer: map['customer'] != null customer: map['customer'] != null
@ -320,25 +301,6 @@ abstract class OrderSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.customer == null) {
throw new FormatException("Missing required field 'customer' on Order.");
}
if (model.employeeId == null) {
throw new FormatException(
"Missing required field 'employee_id' on Order.");
}
if (model.orderDate == null) {
throw new FormatException(
"Missing required field 'order_date' on Order.");
}
if (model.shipperId == null) {
throw new FormatException(
"Missing required field 'shipper_id' on Order.");
}
return { return {
'id': model.id, 'id': model.id,
'customer': CustomerSerializer.toMap(model.customer), 'customer': CustomerSerializer.toMap(model.customer),

View file

@ -213,11 +213,7 @@ class TreeQueryValues extends MapQueryValues {
@generatedSerializable @generatedSerializable
class Tree extends _Tree { class Tree extends _Tree {
Tree( Tree(
{this.id, {this.id, this.rings, List<Fruit> fruits, this.createdAt, this.updatedAt})
@required this.rings,
@required List<Fruit> fruits,
this.createdAt,
this.updatedAt})
: this.fruits = new List.unmodifiable(fruits ?? []); : this.fruits = new List.unmodifiable(fruits ?? []);
@override @override
@ -275,14 +271,6 @@ class Tree extends _Tree {
abstract class TreeSerializer { abstract class TreeSerializer {
static Tree fromMap(Map map) { static Tree fromMap(Map map) {
if (map['rings'] == null) {
throw new FormatException("Missing required field 'rings' on Tree.");
}
if (map['fruits'] == null) {
throw new FormatException("Missing required field 'fruits' on Tree.");
}
return new Tree( return new Tree(
id: map['id'] as String, id: map['id'] as String,
rings: map['rings'] as int, rings: map['rings'] as int,
@ -308,14 +296,6 @@ abstract class TreeSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.rings == null) {
throw new FormatException("Missing required field 'rings' on Tree.");
}
if (model.fruits == null) {
throw new FormatException("Missing required field 'fruits' on Tree.");
}
return { return {
'id': model.id, 'id': model.id,
'rings': model.rings, 'rings': model.rings,

View file

@ -821,7 +821,7 @@ class FooPivotQueryValues extends MapQueryValues {
@generatedSerializable @generatedSerializable
class Unorthodox implements _Unorthodox { class Unorthodox implements _Unorthodox {
const Unorthodox({@required this.name}); const Unorthodox({this.name});
@override @override
final String name; final String name;
@ -847,11 +847,11 @@ class Unorthodox implements _Unorthodox {
@generatedSerializable @generatedSerializable
class WeirdJoin implements _WeirdJoin { class WeirdJoin implements _WeirdJoin {
const WeirdJoin( const WeirdJoin(
{@required this.id, {this.id,
@required this.unorthodox, this.unorthodox,
@required this.song, this.song,
@required List<_Numba> this.numbas, List<_Numba> this.numbas,
@required List<_Foo> this.foos}); List<_Foo> this.foos});
@override @override
final int id; final int id;
@ -905,12 +905,7 @@ class WeirdJoin implements _WeirdJoin {
@generatedSerializable @generatedSerializable
class Song extends _Song { class Song extends _Song {
Song( Song({this.id, this.weirdJoinId, this.title, this.createdAt, this.updatedAt});
{this.id,
@required this.weirdJoinId,
@required this.title,
this.createdAt,
this.updatedAt});
@override @override
final String id; final String id;
@ -962,7 +957,7 @@ class Song extends _Song {
@generatedSerializable @generatedSerializable
class Numba extends _Numba { class Numba extends _Numba {
Numba({@required this.i, @required this.parent}); Numba({this.i, this.parent});
@override @override
final int i; final int i;
@ -990,7 +985,7 @@ class Numba extends _Numba {
@generatedSerializable @generatedSerializable
class Foo implements _Foo { class Foo implements _Foo {
const Foo({@required this.bar, @required List<_WeirdJoin> this.weirdJoins}); const Foo({this.bar, List<_WeirdJoin> this.weirdJoins});
@override @override
final String bar; final String bar;
@ -1022,7 +1017,7 @@ class Foo implements _Foo {
@generatedSerializable @generatedSerializable
class FooPivot implements _FooPivot { class FooPivot implements _FooPivot {
const FooPivot({@required this.weirdJoin, @required this.foo}); const FooPivot({this.weirdJoin, this.foo});
@override @override
final _WeirdJoin weirdJoin; final _WeirdJoin weirdJoin;
@ -1057,10 +1052,6 @@ class FooPivot implements _FooPivot {
abstract class UnorthodoxSerializer { abstract class UnorthodoxSerializer {
static Unorthodox fromMap(Map map) { static Unorthodox fromMap(Map map) {
if (map['name'] == null) {
throw new FormatException("Missing required field 'name' on Unorthodox.");
}
return new Unorthodox(name: map['name'] as String); return new Unorthodox(name: map['name'] as String);
} }
@ -1068,10 +1059,6 @@ abstract class UnorthodoxSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.name == null) {
throw new FormatException("Missing required field 'name' on Unorthodox.");
}
return {'name': model.name}; return {'name': model.name};
} }
} }
@ -1084,28 +1071,6 @@ abstract class UnorthodoxFields {
abstract class WeirdJoinSerializer { abstract class WeirdJoinSerializer {
static WeirdJoin fromMap(Map map) { static WeirdJoin fromMap(Map map) {
if (map['id'] == null) {
throw new FormatException("Missing required field 'id' on WeirdJoin.");
}
if (map['unorthodox'] == null) {
throw new FormatException(
"Missing required field 'unorthodox' on WeirdJoin.");
}
if (map['song'] == null) {
throw new FormatException("Missing required field 'song' on WeirdJoin.");
}
if (map['numbas'] == null) {
throw new FormatException(
"Missing required field 'numbas' on WeirdJoin.");
}
if (map['foos'] == null) {
throw new FormatException("Missing required field 'foos' on WeirdJoin.");
}
return new WeirdJoin( return new WeirdJoin(
id: map['id'] as int, id: map['id'] as int,
unorthodox: map['unorthodox'] != null unorthodox: map['unorthodox'] != null
@ -1132,28 +1097,6 @@ abstract class WeirdJoinSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.id == null) {
throw new FormatException("Missing required field 'id' on WeirdJoin.");
}
if (model.unorthodox == null) {
throw new FormatException(
"Missing required field 'unorthodox' on WeirdJoin.");
}
if (model.song == null) {
throw new FormatException("Missing required field 'song' on WeirdJoin.");
}
if (model.numbas == null) {
throw new FormatException(
"Missing required field 'numbas' on WeirdJoin.");
}
if (model.foos == null) {
throw new FormatException("Missing required field 'foos' on WeirdJoin.");
}
return { return {
'id': model.id, 'id': model.id,
'unorthodox': UnorthodoxSerializer.toMap(model.unorthodox), 'unorthodox': UnorthodoxSerializer.toMap(model.unorthodox),
@ -1186,15 +1129,6 @@ abstract class WeirdJoinFields {
abstract class SongSerializer { abstract class SongSerializer {
static Song fromMap(Map map) { static Song fromMap(Map map) {
if (map['weird_join_id'] == null) {
throw new FormatException(
"Missing required field 'weird_join_id' on Song.");
}
if (map['title'] == null) {
throw new FormatException("Missing required field 'title' on Song.");
}
return new Song( return new Song(
id: map['id'] as String, id: map['id'] as String,
weirdJoinId: map['weird_join_id'] as int, weirdJoinId: map['weird_join_id'] as int,
@ -1215,15 +1149,6 @@ abstract class SongSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.weirdJoinId == null) {
throw new FormatException(
"Missing required field 'weird_join_id' on Song.");
}
if (model.title == null) {
throw new FormatException("Missing required field 'title' on Song.");
}
return { return {
'id': model.id, 'id': model.id,
'weird_join_id': model.weirdJoinId, 'weird_join_id': model.weirdJoinId,
@ -1256,14 +1181,6 @@ abstract class SongFields {
abstract class NumbaSerializer { abstract class NumbaSerializer {
static Numba fromMap(Map map) { static Numba fromMap(Map map) {
if (map['i'] == null) {
throw new FormatException("Missing required field 'i' on Numba.");
}
if (map['parent'] == null) {
throw new FormatException("Missing required field 'parent' on Numba.");
}
return new Numba(i: map['i'] as int, parent: map['parent'] as int); return new Numba(i: map['i'] as int, parent: map['parent'] as int);
} }
@ -1271,14 +1188,6 @@ abstract class NumbaSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.i == null) {
throw new FormatException("Missing required field 'i' on Numba.");
}
if (model.parent == null) {
throw new FormatException("Missing required field 'parent' on Numba.");
}
return {'i': model.i, 'parent': model.parent}; return {'i': model.i, 'parent': model.parent};
} }
} }
@ -1293,14 +1202,6 @@ abstract class NumbaFields {
abstract class FooSerializer { abstract class FooSerializer {
static Foo fromMap(Map map) { static Foo fromMap(Map map) {
if (map['bar'] == null) {
throw new FormatException("Missing required field 'bar' on Foo.");
}
if (map['weird_joins'] == null) {
throw new FormatException("Missing required field 'weird_joins' on Foo.");
}
return new Foo( return new Foo(
bar: map['bar'] as String, bar: map['bar'] as String,
weirdJoins: map['weird_joins'] is Iterable weirdJoins: map['weird_joins'] is Iterable
@ -1315,14 +1216,6 @@ abstract class FooSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.bar == null) {
throw new FormatException("Missing required field 'bar' on Foo.");
}
if (model.weirdJoins == null) {
throw new FormatException("Missing required field 'weird_joins' on Foo.");
}
return { return {
'bar': model.bar, 'bar': model.bar,
'weird_joins': 'weird_joins':
@ -1341,15 +1234,6 @@ abstract class FooFields {
abstract class FooPivotSerializer { abstract class FooPivotSerializer {
static FooPivot fromMap(Map map) { static FooPivot fromMap(Map map) {
if (map['weird_join'] == null) {
throw new FormatException(
"Missing required field 'weird_join' on FooPivot.");
}
if (map['foo'] == null) {
throw new FormatException("Missing required field 'foo' on FooPivot.");
}
return new FooPivot( return new FooPivot(
weirdJoin: map['weird_join'] != null weirdJoin: map['weird_join'] != null
? WeirdJoinSerializer.fromMap(map['weird_join'] as Map) ? WeirdJoinSerializer.fromMap(map['weird_join'] as Map)
@ -1363,15 +1247,6 @@ abstract class FooPivotSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.weirdJoin == null) {
throw new FormatException(
"Missing required field 'weird_join' on FooPivot.");
}
if (model.foo == null) {
throw new FormatException("Missing required field 'foo' on FooPivot.");
}
return { return {
'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin), 'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin),
'foo': FooSerializer.toMap(model.foo) 'foo': FooSerializer.toMap(model.foo)

View file

@ -570,10 +570,10 @@ class RoleQueryValues extends MapQueryValues {
class User extends _User { class User extends _User {
User( User(
{this.id, {this.id,
@required this.username, this.username,
@required this.password, this.password,
@required this.email, this.email,
@required List<_Role> roles, List<_Role> roles,
this.createdAt, this.createdAt,
this.updatedAt}) this.updatedAt})
: this.roles = new List.unmodifiable(roles ?? []); : this.roles = new List.unmodifiable(roles ?? []);
@ -642,7 +642,7 @@ class User extends _User {
@generatedSerializable @generatedSerializable
class RoleUser implements _RoleUser { class RoleUser implements _RoleUser {
const RoleUser({@required this.role, @required this.user}); const RoleUser({this.role, this.user});
@override @override
final _Role role; final _Role role;
@ -670,12 +670,7 @@ class RoleUser implements _RoleUser {
@generatedSerializable @generatedSerializable
class Role extends _Role { class Role extends _Role {
Role( Role({this.id, this.name, List<_User> users, this.createdAt, this.updatedAt})
{this.id,
@required this.name,
@required List<_User> users,
this.createdAt,
this.updatedAt})
: this.users = new List.unmodifiable(users ?? []); : this.users = new List.unmodifiable(users ?? []);
@override @override
@ -733,22 +728,6 @@ class Role extends _Role {
abstract class UserSerializer { abstract class UserSerializer {
static User fromMap(Map map) { static User fromMap(Map map) {
if (map['username'] == null) {
throw new FormatException("Missing required field 'username' on User.");
}
if (map['password'] == null) {
throw new FormatException("Missing required field 'password' on User.");
}
if (map['email'] == null) {
throw new FormatException("Missing required field 'email' on User.");
}
if (map['roles'] == null) {
throw new FormatException("Missing required field 'roles' on User.");
}
return new User( return new User(
id: map['id'] as String, id: map['id'] as String,
username: map['username'] as String, username: map['username'] as String,
@ -776,22 +755,6 @@ abstract class UserSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.username == null) {
throw new FormatException("Missing required field 'username' on User.");
}
if (model.password == null) {
throw new FormatException("Missing required field 'password' on User.");
}
if (model.email == null) {
throw new FormatException("Missing required field 'email' on User.");
}
if (model.roles == null) {
throw new FormatException("Missing required field 'roles' on User.");
}
return { return {
'id': model.id, 'id': model.id,
'username': model.username, 'username': model.username,
@ -832,14 +795,6 @@ abstract class UserFields {
abstract class RoleUserSerializer { abstract class RoleUserSerializer {
static RoleUser fromMap(Map map) { static RoleUser fromMap(Map map) {
if (map['role'] == null) {
throw new FormatException("Missing required field 'role' on RoleUser.");
}
if (map['user'] == null) {
throw new FormatException("Missing required field 'user' on RoleUser.");
}
return new RoleUser( return new RoleUser(
role: map['role'] != null role: map['role'] != null
? RoleSerializer.fromMap(map['role'] as Map) ? RoleSerializer.fromMap(map['role'] as Map)
@ -853,14 +808,6 @@ abstract class RoleUserSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.role == null) {
throw new FormatException("Missing required field 'role' on RoleUser.");
}
if (model.user == null) {
throw new FormatException("Missing required field 'user' on RoleUser.");
}
return { return {
'role': RoleSerializer.toMap(model.role), 'role': RoleSerializer.toMap(model.role),
'user': UserSerializer.toMap(model.user) 'user': UserSerializer.toMap(model.user)
@ -878,14 +825,6 @@ abstract class RoleUserFields {
abstract class RoleSerializer { abstract class RoleSerializer {
static Role fromMap(Map map) { static Role fromMap(Map map) {
if (map['name'] == null) {
throw new FormatException("Missing required field 'name' on Role.");
}
if (map['users'] == null) {
throw new FormatException("Missing required field 'users' on Role.");
}
return new Role( return new Role(
id: map['id'] as String, id: map['id'] as String,
name: map['name'] as String, name: map['name'] as String,
@ -911,14 +850,6 @@ abstract class RoleSerializer {
if (model == null) { if (model == null) {
return null; return null;
} }
if (model.name == null) {
throw new FormatException("Missing required field 'name' on Role.");
}
if (model.users == null) {
throw new FormatException("Missing required field 'users' on Role.");
}
return { return {
'id': model.id, 'id': model.id,
'name': model.name, 'name': model.name,