From acce9a4bb82898cce7e76a0fa302162622c6883a Mon Sep 17 00:00:00 2001 From: Tobe O Date: Tue, 27 Feb 2018 20:12:56 -0500 Subject: [PATCH] Fix bug where all natural fields were excluded --- angel_serialize_generator/lib/serialize.dart | 2 +- .../test/models/author.serializer.g.dart | 5 +++++ angel_serialize_generator/test/models/book.serializer.g.dart | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/angel_serialize_generator/lib/serialize.dart b/angel_serialize_generator/lib/serialize.dart index 35c6632c..e9a506c6 100644 --- a/angel_serialize_generator/lib/serialize.dart +++ b/angel_serialize_generator/lib/serialize.dart @@ -64,7 +64,7 @@ class SerializerGenerator extends GeneratorForAnnotation { // Add named parameters for (var field in ctx.fields) { // Skip excluded fields - if (ctx.excluded.containsKey(field.name)) continue; + if (ctx.excluded[field.name] == true) continue; var alias = ctx.resolveFieldName(field.name); diff --git a/angel_serialize_generator/test/models/author.serializer.g.dart b/angel_serialize_generator/test/models/author.serializer.g.dart index 8f0d0015..7a4945ae 100644 --- a/angel_serialize_generator/test/models/author.serializer.g.dart +++ b/angel_serialize_generator/test/models/author.serializer.g.dart @@ -10,6 +10,10 @@ abstract class AuthorSerializer { Map toMap() { return { 'id': id, + 'name': name, + 'age': age, + 'books': books, + 'newest_book': newestBook, 'created_at': createdAt.toIso8601String(), 'updated_at': updatedAt.toIso8601String() }; @@ -20,6 +24,7 @@ abstract class LibrarySerializer { Map toMap() { return { 'id': id, + 'collection': collection, 'created_at': createdAt.toIso8601String(), 'updated_at': updatedAt.toIso8601String() }; diff --git a/angel_serialize_generator/test/models/book.serializer.g.dart b/angel_serialize_generator/test/models/book.serializer.g.dart index 1e069c7e..d6e83f55 100644 --- a/angel_serialize_generator/test/models/book.serializer.g.dart +++ b/angel_serialize_generator/test/models/book.serializer.g.dart @@ -10,6 +10,10 @@ abstract class BookSerializer { Map toMap() { return { 'id': id, + 'author': author, + 'title': title, + 'description': description, + 'page_count': pageCount, 'created_at': createdAt.toIso8601String(), 'updated_at': updatedAt.toIso8601String() };