Bump to 1.0.0
This commit is contained in:
parent
8e5e0f0377
commit
e2d167613d
12 changed files with 191 additions and 154 deletions
7
.idea/runConfigurations/build_dart.xml
Normal file
7
.idea/runConfigurations/build_dart.xml
Normal 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>
|
|
@ -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>
|
|
@ -4,15 +4,10 @@
|
|||
<content url="file://$MODULE_DIR$/angel_serialize">
|
||||
<excludeFolder url="file://$MODULE_DIR$/angel_serialize/.pub" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/angel_serialize/build" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/angel_serialize/packages" />
|
||||
</content>
|
||||
<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/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>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
|
|
@ -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/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_serialize
|
||||
version: 1.0.0-alpha+1
|
||||
version: 1.0.0
|
||||
description: Static annotations powering Angel model serialization.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/serialize
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_serialize_generator
|
||||
version: 1.0.0-alpha+3
|
||||
version: 1.0.0
|
||||
description: Model serialization generators, designed for use with Angel.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/serialize
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:convert';
|
||||
import 'package:test/test.dart';
|
||||
import 'models/author.dart';
|
||||
import 'models/book.dart';
|
||||
|
||||
const String DEATHLY_HALLOWS_ISBN = '0-545-01022-5';
|
||||
|
|
21
angel_serialize_generator/test/models/author.dart
Normal file
21
angel_serialize_generator/test/models/author.dart
Normal 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;
|
||||
}
|
137
angel_serialize_generator/test/models/author.g.dart
Normal file
137
angel_serialize_generator/test/models/author.g.dart
Normal 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());
|
||||
}
|
||||
}
|
|
@ -8,19 +8,4 @@ part 'book.g.dart';
|
|||
abstract class _Book extends Model {
|
||||
String author, title, description;
|
||||
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;
|
||||
}
|
|
@ -72,131 +72,3 @@ class Book extends _Book {
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,18 @@ import 'package:source_gen/source_gen.dart';
|
|||
import 'package:angel_serialize_generator/angel_serialize_generator.dart';
|
||||
|
||||
final List<BuildAction> actions = [
|
||||
new BuildAction(new PartBuilder([const JsonModelGenerator()]),
|
||||
'angel_serialize_generator',
|
||||
inputs: const ['test/models/*.dart'])
|
||||
new BuildAction(
|
||||
new PartBuilder([const JsonModelGenerator()]),
|
||||
'angel_serialize_generator',
|
||||
inputs: const [
|
||||
'test/models/book.dart',
|
||||
],
|
||||
),
|
||||
new BuildAction(
|
||||
new PartBuilder([const JsonModelGenerator()]),
|
||||
'angel_serialize_generator',
|
||||
inputs: const [
|
||||
'test/models/author.dart',
|
||||
],
|
||||
),
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue