Bump to 1.0.0

This commit is contained in:
Tobe O 2017-12-07 02:08:32 -05:00
parent 8e5e0f0377
commit e2d167613d
12 changed files with 191 additions and 154 deletions

View file

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="build.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" singleton="true" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/angel_serialize_generator/tool/build.dart" />
<option name="workingDirectory" value="$PROJECT_DIR$/angel_serialize_generator" />
<method />
</configuration>
</component>

View file

@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="tests in angel_serialize_generator" type="DartTestRunConfigurationType" factoryName="Dart Test" singleton="true" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/angel_serialize_generator" />
<option name="scope" value="FOLDER" />
<option name="testRunnerOptions" value="-j 4" />
<method />
</configuration>
</component>

View file

@ -4,15 +4,10 @@
<content url="file://$MODULE_DIR$/angel_serialize"> <content url="file://$MODULE_DIR$/angel_serialize">
<excludeFolder url="file://$MODULE_DIR$/angel_serialize/.pub" /> <excludeFolder url="file://$MODULE_DIR$/angel_serialize/.pub" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize/build" /> <excludeFolder url="file://$MODULE_DIR$/angel_serialize/build" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize/packages" />
</content> </content>
<content url="file://$MODULE_DIR$/angel_serialize_generator"> <content url="file://$MODULE_DIR$/angel_serialize_generator">
<excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/.pub" /> <excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/.pub" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/build" /> <excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/build" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/packages" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/test/models/packages" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/test/packages" />
<excludeFolder url="file://$MODULE_DIR$/angel_serialize_generator/tool/packages" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View file

@ -1,2 +1,2 @@
# Generated by pub on 2017-07-10 11:01:13.581030. # Generated by pub on 2017-12-07 02:04:15.968150.
angel_serialize:lib/ angel_serialize:lib/

View file

@ -1,5 +1,5 @@
name: angel_serialize name: angel_serialize
version: 1.0.0-alpha+1 version: 1.0.0
description: Static annotations powering Angel model serialization. description: Static annotations powering Angel model serialization.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/serialize homepage: https://github.com/angel-dart/serialize

View file

@ -1,5 +1,5 @@
name: angel_serialize_generator name: angel_serialize_generator
version: 1.0.0-alpha+3 version: 1.0.0
description: Model serialization generators, designed for use with Angel. description: Model serialization generators, designed for use with Angel.
author: Tobe O <thosakwe@gmail.com> author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/serialize homepage: https://github.com/angel-dart/serialize

View file

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'models/author.dart';
import 'models/book.dart'; import 'models/book.dart';
const String DEATHLY_HALLOWS_ISBN = '0-545-01022-5'; const String DEATHLY_HALLOWS_ISBN = '0-545-01022-5';

View file

@ -0,0 +1,21 @@
library angel_serialize.test.models.author;
import 'package:angel_framework/common.dart';
import 'package:angel_serialize/angel_serialize.dart';
import 'book.dart';
part 'author.g.dart';
@serializable
abstract class _Author extends Model {
String name;
int age;
List<Book> books;
Book newestBook;
@exclude
String secret;
}
@serializable
abstract class _Library extends Model {
Map<String, Book> collection;
}

View file

@ -0,0 +1,137 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of angel_serialize.test.models.author;
// **************************************************************************
// Generator: JsonModelGenerator
// **************************************************************************
class Author extends _Author {
@override
String id;
@override
String name;
@override
int age;
@override
List<Book> books;
@override
Book newestBook;
@override
DateTime createdAt;
@override
DateTime updatedAt;
Author(
{this.id,
this.name,
this.age,
this.books,
this.newestBook,
this.createdAt,
this.updatedAt});
factory Author.fromJson(Map data) {
return new Author(
id: data['id'],
name: data['name'],
age: data['age'],
books: data['books'] is List
? data['books']
.map((x) =>
x == null ? null : (x is Book ? x : new Book.fromJson(x)))
.toList()
: null,
newestBook: data['newest_book'] == null
? null
: (data['newest_book'] is Book
? data['newest_book']
: new Book.fromJson(data['newest_book'])),
createdAt: data['created_at'] is DateTime
? data['created_at']
: (data['created_at'] is String
? DateTime.parse(data['created_at'])
: null),
updatedAt: data['updated_at'] is DateTime
? data['updated_at']
: (data['updated_at'] is String
? DateTime.parse(data['updated_at'])
: null));
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'age': age,
'books': books,
'newest_book': newestBook,
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
};
static Author parse(Map map) => new Author.fromJson(map);
Author clone() {
return new Author.fromJson(toJson());
}
}
class Library extends _Library {
@override
String id;
@override
Map<String, Book> collection;
@override
DateTime createdAt;
@override
DateTime updatedAt;
Library({this.id, this.collection, this.createdAt, this.updatedAt});
factory Library.fromJson(Map data) {
return new Library(
id: data['id'],
collection: data['collection'] is Map
? data['collection'].keys.fold({}, (out, k) {
out[k] = data['collection'][k] == null
? null
: (data['collection'][k] is Book
? data['collection'][k]
: new Book.fromJson(data['collection'][k]));
return out;
})
: null,
createdAt: data['created_at'] is DateTime
? data['created_at']
: (data['created_at'] is String
? DateTime.parse(data['created_at'])
: null),
updatedAt: data['updated_at'] is DateTime
? data['updated_at']
: (data['updated_at'] is String
? DateTime.parse(data['updated_at'])
: null));
}
Map<String, dynamic> toJson() => {
'id': id,
'collection': collection,
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
};
static Library parse(Map map) => new Library.fromJson(map);
Library clone() {
return new Library.fromJson(toJson());
}
}

View file

@ -9,18 +9,3 @@ abstract class _Book extends Model {
String author, title, description; String author, title, description;
int pageCount; int pageCount;
} }
@serializable
abstract class _Author extends Model {
String name;
int age;
List<_Book> books;
_Book newestBook;
@exclude
String secret;
}
@serializable
abstract class _Library extends Model {
Map<String, _Book> collection;
}

View file

@ -72,131 +72,3 @@ class Book extends _Book {
return new Book.fromJson(toJson()); return new Book.fromJson(toJson());
} }
} }
class Author extends _Author {
@override
String id;
@override
String name;
@override
int age;
@override
List<_Book> books;
@override
_Book newestBook;
@override
DateTime createdAt;
@override
DateTime updatedAt;
Author(
{this.id,
this.name,
this.age,
this.books,
this.newestBook,
this.createdAt,
this.updatedAt});
factory Author.fromJson(Map data) {
return new Author(
id: data['id'],
name: data['name'],
age: data['age'],
books: data['books'] is List
? data['books']
.map((x) =>
x == null ? null : (x is Book ? x : new Book.fromJson(x)))
.toList()
: null,
newestBook: data['newest_book'] is Book
? data['newest_book']
: new Book.fromJson(data['newest_book']),
createdAt: data['created_at'] is DateTime
? data['created_at']
: (data['created_at'] is String
? DateTime.parse(data['created_at'])
: null),
updatedAt: data['updated_at'] is DateTime
? data['updated_at']
: (data['updated_at'] is String
? DateTime.parse(data['updated_at'])
: null));
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'age': age,
'books': books,
'newest_book': newestBook.toJson(),
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
};
static Author parse(Map map) => new Author.fromJson(map);
Author clone() {
return new Author.fromJson(toJson());
}
}
class Library extends _Library {
@override
String id;
@override
Map<String, _Book> collection;
@override
DateTime createdAt;
@override
DateTime updatedAt;
Library({this.id, this.collection, this.createdAt, this.updatedAt});
factory Library.fromJson(Map data) {
return new Library(
id: data['id'],
collection: data['collection'] is Map
? data['collection'].keys.fold({}, (out, k) {
out[k] = data['collection'][k] == null
? null
: (data['collection'][k] is Book
? data['collection'][k]
: new Book.fromJson(data['collection'][k]));
return out;
})
: null,
createdAt: data['created_at'] is DateTime
? data['created_at']
: (data['created_at'] is String
? DateTime.parse(data['created_at'])
: null),
updatedAt: data['updated_at'] is DateTime
? data['updated_at']
: (data['updated_at'] is String
? DateTime.parse(data['updated_at'])
: null));
}
Map<String, dynamic> toJson() => {
'id': id,
'collection': collection,
'created_at': createdAt == null ? null : createdAt.toIso8601String(),
'updated_at': updatedAt == null ? null : updatedAt.toIso8601String()
};
static Library parse(Map map) => new Library.fromJson(map);
Library clone() {
return new Library.fromJson(toJson());
}
}

View file

@ -3,7 +3,18 @@ import 'package:source_gen/source_gen.dart';
import 'package:angel_serialize_generator/angel_serialize_generator.dart'; import 'package:angel_serialize_generator/angel_serialize_generator.dart';
final List<BuildAction> actions = [ final List<BuildAction> actions = [
new BuildAction(new PartBuilder([const JsonModelGenerator()]), new BuildAction(
new PartBuilder([const JsonModelGenerator()]),
'angel_serialize_generator', 'angel_serialize_generator',
inputs: const ['test/models/*.dart']) inputs: const [
'test/models/book.dart',
],
),
new BuildAction(
new PartBuilder([const JsonModelGenerator()]),
'angel_serialize_generator',
inputs: const [
'test/models/author.dart',
],
),
]; ];