Updated serializer generator

This commit is contained in:
thomashii 2021-07-25 18:47:41 +08:00
parent e81b44af8e
commit cd2e0f8095
5 changed files with 94 additions and 53 deletions

View file

@ -1,13 +1,24 @@
# 4.0.1
# Change Log
## 4.0.2
* Fixed `build.yaml` to use `angel3` packages
* Updated README
## 4.0.1
* Resolved static analysis warnings
# 4.0.0
## 4.0.0
* Migrated to support Dart SDK 2.12.x NNBD
# 3.0.0
## 3.0.0
* Migrated to work with Dart SDK 2.12.x Non NNBD
# 2.5.0
## 2.5.0
* Support mutable models (again).
* Use `whereType()` instead of chaining `where()` and `cast()`.
* Support pulling fields from parent classes and interfaces.
@ -15,61 +26,75 @@
fields lack a setter.
* Don't type-annotate initializing formals.
# 2.4.4
## 2.4.4
* Remove unnecessary `new` and `const`.
# 2.4.3
## 2.4.3
* Generate `Codec` and `Converter` classes.
* Generate `toString` methods.
* Include original documentation comments from the model.
# 2.4.2
## 2.4.2
* Fix bug where enums didn't support default values.
* Stop emitting `@required` on items with default values.
* Create default `@SerializableField` for fields without them.
# 2.4.1+1
## 2.4.1+1
* Change `as Iterable<Map>` to `.cast<Map>`.
# 2.4.1
## 2.4.1
* Support `serializesTo`.
* Don't emit `@required` if there is a default value.
* Deprecate `autoIdAndDateFields`.
# 2.4.0
## 2.4.0
* Introduce `@SerializableField`, and say goodbye to annotation hell.
* Support custom (de)serializers.
* Allow passing of annotations to the generated class.
* Fixted TypeScript `ref` generator.
# 2.3.0
## 2.3.0
* Add `@DefaultValue` support.
# 2.2.2
## 2.2.2
* Split out TS def builder, to emit to source.
# 2.2.1
## 2.2.1
* Explicit changes for assisting `angel_orm_generator`.
# 2.2.0
## 2.2.0
* Build to `cache`.
* Only generate one `.g.dart` file.
* Support for `Uint8List`.
* Use `.cast()` for `List`s and `Map`s of *non-`Model`* types.
# 2.1.2
## 2.1.2
* Add `declare module` to generated TypeScript files.
# 2.1.1
## 2.1.1
* Generate `hashCode`.
# 2.1.0
## 2.1.0
* Removed dependency on `package:id`.
* Update dependencies for Dart2Stable.
* `jsonModelBuilder` now uses `SharedPartBuilder`, rather than
`PartBuilder`.
# 2.0.10
## 2.0.10
* Generate `XFields.allFields` constant.
* No longer breaks in cases where `dynamic` is present.
* Call `toJson` in `toMap` on nested models.
@ -77,67 +102,83 @@ fields lack a setter.
* Use the new `@generatedSerializable` to *always* find generated
models.
# 2.0.9+4
## 2.0.9+4
* Remove `defaults` in `build.yaml`.
# 2.0.9+3
## 2.0.9+3
* Fix a cast error when self-referencing nested list expressions.
# 2.0.9+2
## 2.0.9+2
* Fix previously unseen cast errors with enums.
# 2.0.9+1
## 2.0.9+1
* Fix a cast error when deserializing nested model classes.
# 2.0.9
## 2.0.9
* Upgrade to `source_gen@^0.8.0`.
# 2.0.8+3
## 2.0.8+3
* Don't fail on `null` in `toMap`.
* Support self-referencing via `toJson()`.
# 2.0.8+2
## 2.0.8+2
* Better discern when custom methods disqualify classes
from `const` protection.
# 2.0.8+1
## 2.0.8+1
* Fix generation of `const` constructors with iterables.
# 2.0.8
## 2.0.8
* Now supports de/serialization of `enum` types.
* Generate `const` constructors when possible.
* Remove `whereType`, perform manual coercion.
* Generate a `fromMap` with typecasting, for Dart 2's sake.
# 2.0.7
## 2.0.7
* Create unmodifiable Lists and Maps.
* Support `@required` on fields.
* Affix an `@immutable` annotation to classes, if
`package:meta` is imported.
* Add `/// <reference path="..." />` to TypeScript models.
# 2.0.6
## 2.0.6
* Support for using `abstract` to create immutable model classes.
* Add support for custom constructor parameters.
* Closed [#21](https://github.com/angel-dart/serialize/issues/21) - better naming
* Closed [##21](https://github.com/angel-dart/serialize/issues/21) - better naming
of `Map` types.
* Added overridden `==` operators.
# 2.0.5
## 2.0.5
* Deserialization now supports un-serialized `DateTime`.
* Better support for regular typed Lists and Maps in TypeScript.
# 2.0.4
## 2.0.4
* Fields in TypeScript definitions are now nullable by default.
# 2.0.3
## 2.0.3
* Added a `TypeScriptDefinitionBuilder`.
# 2.0.2
## 2.0.2
* Generates an `XFields` class with the serialized names of
all fields in a model class `X`.
* Removed unnecessary named parameters from `XSerializer.fromMap`.
# 2.0.1
## 2.0.1
* Ensured that `List` is only transformed if
it generically references a `Model`.
it generically references a `Model`.

View file

@ -1,12 +1,11 @@
# angel3_serialize_generator
[![version](https://img.shields.io/badge/pub-v4.0.1-brightgreen)](https://pub.dartlang.org/packages/angel3_serialize_generator)
# Angel3 Serialize Generator
[![version](https://img.shields.io/badge/pub-v4.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_serialize_generator)
[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety)
[![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion)
[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/serialize/angel_serialize_generator/LICENSE)
The builder for Angel3 model serialization.
The builder for Angel's model serialization.
Find documentation in the main project repo:
https://github.com/angel-dart/serialize
Find documentation in the main project repo: <https://github.com/dukefirehawk/angel/tree/master/packages/serialize>

View file

@ -1,6 +1,6 @@
builders:
angel_serialize:
import: "package:angel_serialize_generator/angel_serialize_generator.dart"
import: "package:angel3_serialize_generator/angel3_serialize_generator.dart"
builder_factories:
- jsonModelBuilder
- serializerBuilder
@ -8,12 +8,12 @@ builders:
build_to: cache
build_extensions:
.dart:
- ".angel_serialize.g.part"
- ".angel_serialize_serializer.g.part"
- ".angel3_serialize.g.part"
- ".angel3_serialize_serializer.g.part"
applies_builders: ["source_gen|combining_builder", "source_gen|part_cleanup"]
runs_before: ["angel_orm_generator|angel_orm"]
runs_before: ["angel3_orm_generator|angel3_orm"]
typescript:
import: "package:angel_serialize_generator/angel_serialize_generator.dart"
import: "package:angel3_serialize_generator/angel3_serialize_generator.dart"
builder_factories:
- typescriptDefinitionBuilder
auto_apply: root_package

View file

@ -25,12 +25,12 @@ part 'serialize.dart';
part 'typescript.dart';
Builder jsonModelBuilder(_) {
return SharedPartBuilder(const [JsonModelGenerator()], 'angel_serialize');
return SharedPartBuilder(const [JsonModelGenerator()], 'angel3_serialize');
}
Builder serializerBuilder(_) {
return SharedPartBuilder(
const [SerializerGenerator()], 'angel_serialize_serializer');
const [SerializerGenerator()], 'angel3_serialize_serializer');
}
Builder typescriptDefinitionBuilder(_) {

View file

@ -1,7 +1,8 @@
name: angel3_serialize_generator
version: 4.0.1
description: Model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling.
homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/serialize/angel_serialize_generator
version: 4.0.2
description: Angel3 model serialization generators, designed for use with Angel. Combine with angel_serialize for flexible modeling.
homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/angel3/packages/serialize/angel_serialize_generator
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies: