Skip to content

Commit

Permalink
Release 1.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
smotastic committed Jan 27, 2022
1 parent 8cf5e97 commit d601f8a
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 23 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,40 @@ class DogMapperImpl extends DogMapper {
}
}
```
### Ignore Fields
Fields can be ignored, by specififying the `ignore` attribute on the Mapping `Annotation``

```dart
class Dog {
final String name;
String? breed;
Dog(this.name);
}
class DogModel {
final String name;
final String breed;
DogModel(this.name, this.breed);
}
```

```dart
@Mapper()
class DogMapper {
@Mapping(target: 'breed', ignore: true)
Dog fromModel(DogModel model);
}
```

Will generate the following Mapper.
```dart
class DogMapperImpl extends DogMapper {
@override
Dog fromModel(DogModel model) {
Dog dog = Dog(model.name);
return dog;
}
}
```

## Nested Bean Mapping

Expand Down
6 changes: 3 additions & 3 deletions example/.packages
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2022-01-27 10:48:43.963580.
# Generated by pub on 2022-01-27 12:30:08.037679.
_fe_analyzer_shared:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-34.0.0/lib/
analyzer:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/analyzer-3.2.0/lib/
args:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/args-2.1.1/lib/
Expand Down Expand Up @@ -49,8 +49,8 @@ pub_semver:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/pub_semver
pubspec_parse:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-1.0.0/lib/
shelf:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/shelf-1.1.4/lib/
shelf_web_socket:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-1.0.1/lib/
smartstruct:../smartstruct/lib/
smartstruct_generator:../generator/lib/
smartstruct:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/smartstruct-1.2.5/lib/
smartstruct_generator:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/smartstruct_generator-1.2.5/lib/
source_gen:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/source_gen-1.2.1/lib/
source_span:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib/
stack_trace:file:///Users/smotastic/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib/
Expand Down
16 changes: 8 additions & 8 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@ packages:
smartstruct:
dependency: "direct main"
description:
path: "../smartstruct"
relative: true
source: path
version: "1.2.4+1"
name: smartstruct
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
smartstruct_generator:
dependency: "direct dev"
description:
path: "../generator"
relative: true
source: path
version: "1.2.4+1"
name: smartstruct_generator
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
source_gen:
dependency: transitive
description:
Expand Down
10 changes: 6 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ environment:
publish_to: none
dependencies:
injectable: ^1.5.3
smartstruct:
path: ../smartstruct
# smartstruct:
# path: ../smartstruct
smartstruct: ^1.2.5
dev_dependencies:
build_runner: ^2.1.7
injectable_generator: ^1.5.3
smartstruct_generator:
path: ../generator
# smartstruct_generator:
# path: ../generator
smartstruct_generator: ^1.2.5
3 changes: 3 additions & 0 deletions generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v1.2.5
- Ignore certain fields (https://github.com/smotastic/smartstruct/issues/40)

# v1.2.4+1
- Bugfix: Mapper failing to generate when using interfaces https://github.com/smotastic/smartstruct/issues/35

Expand Down
8 changes: 4 additions & 4 deletions generator/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ packages:
smartstruct:
dependency: "direct main"
description:
path: "../smartstruct"
relative: true
source: path
version: "1.2.4+1"
name: smartstruct
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.5"
source_gen:
dependency: "direct main"
description:
Expand Down
7 changes: 4 additions & 3 deletions generator/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: smartstruct_generator
description: smartstruct - A dart bean mapper annotation processor - the easy nullsafe way!
version: 1.2.4+1
version: 1.2.5
homepage: https://github.com/smotastic/smartstruct
environment:
sdk: ">=2.12.0 <3.0.0"
Expand All @@ -14,6 +14,7 @@ dependencies:
build: ^2.2.1
code_builder: ^4.1.0
path: ^1.8.1
smartstruct:
path: ../smartstruct
# smartstruct:
# path: ../smartstruct
smartstruct: ^1.2.5
source_gen: ^1.2.1
3 changes: 3 additions & 0 deletions smartstruct/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v1.2.5
- Ignore certain fields (https://github.com/smotastic/smartstruct/issues/40)

# v1.2.4+1
- Bugfix: Mapper failing to generate when using interfaces https://github.com/smotastic/smartstruct/issues/35

Expand Down
34 changes: 34 additions & 0 deletions smartstruct/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,40 @@ class DogMapperImpl extends DogMapper {
}
}
```
### Ignore Fields
Fields can be ignored, by specififying the `ignore` attribute on the Mapping `Annotation``

```dart
class Dog {
final String name;
String? breed;
Dog(this.name);
}
class DogModel {
final String name;
final String breed;
DogModel(this.name, this.breed);
}
```

```dart
@Mapper()
class DogMapper {
@Mapping(target: 'breed', ignore: true)
Dog fromModel(DogModel model);
}
```

Will generate the following Mapper.
```dart
class DogMapperImpl extends DogMapper {
@override
Dog fromModel(DogModel model) {
Dog dog = Dog(model.name);
return dog;
}
}
```

## Nested Bean Mapping

Expand Down
2 changes: 1 addition & 1 deletion smartstruct/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: smartstruct
description: smartstruct - A dart bean mapper annotation processor - the easy nullsafe way!
version: 1.2.4+1
version: 1.2.5
homepage: https://github.com/smotastic/smartstruct
environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit d601f8a

Please sign in to comment.