Skip to content

Commit

Permalink
[bump] version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
schultek committed Jan 11, 2023
1 parent 52aab92 commit 1371c31
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 194 deletions.
109 changes: 17 additions & 92 deletions packages/dart_mappable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
# 2.0.0-dev.13

- Bug fixes and documentation.

# 2.0.0-dev.12

- Boost performance by caching mappers.
- Small bug fixes.

# 2.0.0-dev.11

- Fixed missing linked enums ([#50](https://github.com/schultek/dart_mappable/issues/50))

# 2.0.0-dev.10

- Fixed analysis issues.

# 2.0.0-dev.9

- Added generating combined container using `@MappableLib(createCombinedContainer: true)`.

# 2.0.0-dev.8

- Added compatibility support for `json_serializable` models and `fast_immutable_collections`.

# 2.0.0-dev.7
# 2.0.0

- Mappers are now generated for each file containing annotated classes. This removes the
need to specify entry points in the `build.yaml`.

> This is now similar to how packages like `json_serializable` or `freezed` generate code.
- Generated files are now `part` files and need to be included as such.
- Instead of one global `Mapper` each class has its own mapper.
- All annotated classes must now use their respective `<MyClass>Mappable` mixin.
- Instead of one global `Mapper` each class has its own `<ClassName>Mapper`.
- A new global container that includes all models can now be generated using
`@MappableLib(createCombinedContainer: true)`.
- Mappers can be linked together to enable working with multiple classes.
- Removed `@CustomMapper` annotation in favor of `includeCustomMappers` property on `@MappableClass()`.

Expand All @@ -40,83 +18,30 @@
- Documentation is now separated from the README using the official pub.dev documentation topics.
Find the new documentation [here](https://pub.dev/documentation/dart_mappable/latest/topics/Introduction-topic.html)

# 2.0.0-dev.6
- Improvements in performance and support for generics and inheritance.

- Fixed issue where code where wrongly generated for models outside the package.

While the builder now stops at package boundaries by default, this can be overruled
by explicitly using the `@MappableLib()` annotation on an import statement.

- Added the [CheckTypesHook] to allow for custom discriminator checks on subclasses in a
- Added the [CheckTypesHook] to allow for custom discriminator checks on subclasses in a
polymorphic class structure.

# 2.0.0-dev.5

- Removed the `Mappable` mixin in favor of the new class-specific mixins.

All annotated classes must now mixin their respective `<MyClass>Mappable` mixin.
More details [here](https://pub.dev/packages/dart_mappable/versions/2.0.0-dev.5#get-started).
- CopyWith is now more powerful and also works for generic or polymorphic classes, while being
completely type-safe.

# 2.0.0-dev.4
When called on a superclass, the concrete subtype will be retained through a
`.copyWith` call, which also respects generics:

- Fixed bug with incorrect type args in copyWith

# 2.0.0-dev.3

- Fixed various issues with the copyWith implementation for inherited classes.

CopyWith now works on a wider range of parameters and is completely subtype-safe.
Specifically a parameter of static type `A` but concrete type `B extends A` keeps
it concrete type through any `.copyWith` call, including lists and maps.

# 2.0.0-dev.2

- Fixed bug with missing copyWith parameters.

# 2.0.0-dev.1

- Added support for inherited copyWith implementations.

When using polymorphism or any inheritance, you will now be able to call
`.copyWith` on the superclass to change any field that is inherited by all
sub-classes. The concrete subclass types will be retained through such a
`.copyWith` call and also respects generics.

```dart
// with `class A` and `class B extends A`
A a = B(); // static type A, dynamic type B
// with `class A` and `class B<T> extends A`
A a = B<int>(); // static type A, dynamic type B<int>
// signature will be `A copyWith()`, so static type A
A a2 = a.copyWith();
// this will still resolve to a dynamic type of B
assert(a2 is B);
// this will still resolve to a dynamic type of B<int>
assert(a2 is B<int>);
```

Classes using this must mixin the newly generated `<MyClass>Mixin`. More details
[here](https://pub.dev/packages/dart_mappable/versions/2.0.0-dev.1#copywith-and-polymorphism).

# 2.0.0-dev.0

- Improved encoding of generic instances.

Any encoding method (Mapper.toValue, Mapper.toMap, Mapper.toJson) now also takes a
generic type argument `T`, which must be an assignable type for the passed value.
When `T` and the values `runtimeType` match exactly, it is encoded as normal. If not, a `__type`
property is added with the specific type of `value`. This can then be used to decode the value
without specifying a target type.

```dart
// this will encode normal without '__type'
Mapper.toValue<MyClass>>(myClassInstance);
Mapper.toValue(MyClass()); // works because of type inference
Mapper.toValue<MyGenericClass<int>>(myGenericClassInstance);
// this will add the '__type' property
Mapper.toValue<dynamic>(myClassInstance);
Mapper.toValue(someDynamicVariable); // where type inference does not work
Mapper.toValue<MyGenericClass>(myGenericClassInstance); // because the instance has a specific type
```
For more checkout the [docs](https://pub.dev/documentation/dart_mappable/latest/topics/Copy-With-topic.html)
or [example](https://github.com/schultek/dart_mappable/tree/main/examples/polymorph_copywith)

# 1.2.0

Expand Down
4 changes: 2 additions & 2 deletions packages/dart_mappable/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dart_mappable
description: Improved json serialization and data classes with full support for generics, inheritance, customization and more.
version: 2.0.0-dev.13
version: 2.0.0
repository: https://github.com/schultek/dart_mappable
issue_tracker: https://github.com/schultek/dart_mappable/issues
funding:
Expand All @@ -16,6 +16,6 @@ dependencies:

dev_dependencies:
build_runner: ^2.2.0
dart_mappable_builder: ^2.0.0-dev.13
dart_mappable_builder: ^2.0.0
lints: '>=1.0.0 <3.0.0'
test: ^1.20.1
118 changes: 20 additions & 98 deletions packages/dart_mappable_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,47 @@
# 2.0.0-dev.13

- Bug fixes and documentation.

# 2.0.0-dev.12

- Boost performance by caching mappers.
- Small bug fixes.

# 2.0.0-dev.11

- Fixed missing linked enums ([#50](https://github.com/schultek/dart_mappable/issues/50))

# 2.0.0-dev.10

- Fixed analysis issues.

# 2.0.0-dev.9

- Added generating combined container using `@MappableLib(createCombinedContainer: true)`.

# 2.0.0-dev.8

- Added compatibility support for `json_serializable` models and `fast_immutable_collections`.

# 2.0.0-dev.7
# 2.0.0

- Mappers are now generated for each file containing annotated classes. This removes the
need to specify entry points in the `build.yaml`.

> This is now similar to how packages like `json_serializable` or `freezed` generate code.
- Generated files are now `part` files and need to be included as such.
- Instead of one global `Mapper` each class has its own mapper.
- All annotated classes must now use their respective `<MyClass>Mappable` mixin.
- Instead of one global `Mapper` each class has its own `<ClassName>Mapper`.
- A new global container that includes all models can now be generated using
`@MappableLib(createCombinedContainer: true)`.
- Mappers can be linked together to enable working with multiple classes.
- Removed `@CustomMapper` annotation in favor of `includeCustomMappers` property on `@MappableClass()`.

For a detailed migration guide, see [this issue](https://github.com/schultek/dart_mappable/issues/46).

- Documentation is now separated from the README using the official pub.dev documentation topics.
Find the new documentation [here](https://pub.dev/documentation/dart_mappable/latest/topics/Introduction-topic.html)

# 2.0.0-dev.6

- Fixed issue where code where wrongly generated for models outside the package.

While the builder now stops at package boundaries by default, this can be overruled
by explicitly using the `@MappableLib()` annotation on an import statement.
- Improvements in performance and support for generics and inheritance.

- Added the [CheckTypesHook] to allow for custom discriminator checks on subclasses in a
polymorphic class structure.

# 2.0.0-dev.5

- Removed the `Mappable` mixin in favor of the new class-specific mixins.

All annotated classes must now mixin their respective `<MyClass>Mappable` mixin.
More details [here](https://pub.dev/packages/dart_mappable/versions/2.0.0-dev.5#get-started).

# 2.0.0-dev.4

- Fixed bug with incorrect type args in copyWith

# 2.0.0-dev.3

- Fixed various issues with the copyWith implementation for inherited classes.

CopyWith now works on a wider range of parameters and is completely subtype-safe.
Specifically a parameter of static type `A` but concrete type `B extends A` keeps
it concrete type through any `.copyWith` call, including lists and maps.

# 2.0.0-dev.2

- Fixed bug with missing copyWith parameters.

# 2.0.0-dev.1

- Added support for inherited copyWith implementations.

When using polymorphism or any inheritance, you will now be able to call
`.copyWith` on the superclass to change any field that is inherited by all
sub-classes. The concrete subclass types will be retained through such a
`.copyWith` call and also respects generics.
- CopyWith is now more powerful and also works for generic or polymorphic classes, while being
completely type-safe.

When called on a superclass, the concrete subtype will be retained through a
`.copyWith` call, which also respects generics:

```dart
// with `class A` and `class B extends A`
A a = B(); // static type A, dynamic type B
// with `class A` and `class B<T> extends A`
A a = B<int>(); // static type A, dynamic type B<int>
// signature will be `A copyWith()`, so static type A
A a2 = a.copyWith();
// this will still resolve to a dynamic type of B
assert(a2 is B);
// this will still resolve to a dynamic type of B<int>
assert(a2 is B<int>);
```

Classes using this must mixin the newly generated `<MyClass>Mixin`. More details
[here](https://pub.dev/packages/dart_mappable/versions/2.0.0-dev.1#copywith-and-polymorphism).

# 2.0.0-dev.0

- Depend on `analyzer: ^5.0.0`
- Imports in the generated code are now prefixed to allow
for same names in different libs.
- Improved encoding of generic instances.

Any encoding method (Mapper.toValue, Mapper.toMap, Mapper.toJson) now also takes a
generic type argument `T`, which must be an assignable type for the passed value.
When `T` and the values `runtimeType` match exactly, it is encoded as normal. If not, a `__type`
property is added with the specific type of `value`. This can then be used to decode the value
without specifying a target type.

```dart
// this will encode normal without '__type'
Mapper.toValue<MyClass>>(myClassInstance);
Mapper.toValue(MyClass()); // works because of type inference
Mapper.toValue<MyGenericClass<int>>(myGenericClassInstance);
// this will add the '__type' property
Mapper.toValue<dynamic>(myClassInstance);
Mapper.toValue(someDynamicVariable); // where type inference does not work
Mapper.toValue<MyGenericClass>(myGenericClassInstance); // because the instance has a specific type
```
For more checkout the [docs](https://pub.dev/documentation/dart_mappable/latest/topics/Copy-With-topic.html)
or [example](https://github.com/schultek/dart_mappable/tree/main/examples/polymorph_copywith)

# 1.2.0

Expand Down
4 changes: 2 additions & 2 deletions packages/dart_mappable_builder/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dart_mappable_builder
description: Improved json serialization and data classes with full support for generics, inheritance, customization and more.
version: 2.0.0-dev.13
version: 2.0.0
repository: https://github.com/schultek/dart_mappable
issue_tracker: https://github.com/schultek/dart_mappable/issues
funding:
Expand All @@ -14,7 +14,7 @@ dependencies:
ansicolor: ^2.0.1
build: ^2.0.0
collection: ^1.15.0
dart_mappable: ^2.0.0-dev.13
dart_mappable: ^2.0.0
dart_style: ^2.2.4
glob: ^2.1.0
path: ^1.8.0
Expand Down

0 comments on commit 1371c31

Please sign in to comment.