From a30b99a821de893e03cb5ea77bf6e0641da41fde Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 6 Jan 2019 18:50:33 -0500 Subject: [PATCH] Deprecate DefaultValue() and Alias() --- angel_serialize/lib/angel_serialize.dart | 33 ++++++++++++++++++++++-- angel_serialize_generator/pubspec.yaml | 5 +++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/angel_serialize/lib/angel_serialize.dart b/angel_serialize/lib/angel_serialize.dart index 26617936..33ff3fc0 100644 --- a/angel_serialize/lib/angel_serialize.dart +++ b/angel_serialize/lib/angel_serialize.dart @@ -11,13 +11,40 @@ class Exclude { const Exclude exclude = const Exclude(); -/// Marks a field as having a default value. +@deprecated + +/// Prefer [SerializableField] instead. class DefaultValue { final value; const DefaultValue(this.value); } +/// Attaches options to a field. +class SerializableField { + /// An alternative name for this field. + final String alias; + + /// A default for this field. + final defaultValue; + + /// A custom serializer for this field. + final Symbol serializer; + + /// A custom serializer for this field. + final Symbol deserializer; + + /// A list of constant members to affix to the generated class. + final List includeAnnotations; + + SerializableField( + {this.alias, + this.defaultValue, + this.serializer, + this.deserializer, + this.includeAnnotations: const []}); +} + /// Marks a class as eligible for serialization. class Serializable { const Serializable( @@ -62,7 +89,9 @@ abstract class Serializers { static const int typescript = 2; } -/// Specifies an alias for a field within its JSON representation. +@deprecated + +/// Prefer [SerializableField] instead. class Alias { final String name; diff --git a/angel_serialize_generator/pubspec.yaml b/angel_serialize_generator/pubspec.yaml index 5561186e..134d9e6e 100644 --- a/angel_serialize_generator/pubspec.yaml +++ b/angel_serialize_generator/pubspec.yaml @@ -21,4 +21,7 @@ dependencies: dev_dependencies: build_runner: ^1.0.0 collection: ^1.0.0 - test: ^1.0.0 \ No newline at end of file + test: ^1.0.0 +dependency_overrides: + angel_serialize: + path: ../angel_serialize \ No newline at end of file