Skip to content

Commit b9991dc

Browse files
authored
Prepare to release v0.2.3 json_annotations (#127)
Added a lot of doc comments
1 parent daff97d commit b9991dc

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

json_annotation/lib/json_annotation.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
/// Use these annotations on members you'd like to enable source generation on.
5+
/// Provides annotation classes to use with
6+
/// [json_serializable](https://pub.dartlang.org/packages/json_serializable).
7+
///
8+
/// Also contains helper functions and classes – prefixed with `$` used by
9+
/// `json_serializable` when generating wrappers.
10+
library json_annotation;
611

712
export 'src/json_literal.dart';
813
export 'src/json_serializable.dart';

json_annotation/lib/src/json_literal.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
/// An annotation used to generate a private field containing the contents of a
6+
/// JSON file.
7+
///
8+
/// The annotation can be applied to any member, but usually it's applied to
9+
/// getter.
510
class JsonLiteral {
611
/// The relative path from the Dart file with the annotation to the file
712
/// containing the source JSON.

json_annotation/lib/src/json_serializable.dart

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'dart:collection';
66

7+
/// An annotation used to specify a class to generate code for.
78
class JsonSerializable {
89
// TODO(kevmoo): document these fields
910
final bool createFactory;
@@ -77,20 +78,39 @@ class JsonKey {
7778
const JsonKey({this.name, this.nullable, this.includeIfNull, this.ignore});
7879
}
7980

80-
// TODO(kevmoo): Add documentation
81+
/// Helper classes used in generated code when
82+
/// `JsonSerializableGenerator.useWrappers` is `true`.
83+
///
84+
/// Should not be used directly.
8185
abstract class $JsonMapWrapper extends UnmodifiableMapBase<String, dynamic> {}
8286

87+
/// Helper function used in generated code when
88+
/// `JsonSerializableGenerator.useWrappers` is `true`.
89+
///
90+
/// Should not be used directly.
8391
Map<String, dynamic> $wrapMap<K, V>(
8492
Map<K, V> source, dynamic converter(V key)) =>
8593
new _MappingMap(source, converter);
8694

95+
/// Helper function used in generated code when
96+
/// `JsonSerializableGenerator.useWrappers` is `true`.
97+
///
98+
/// Should not be used directly.
8799
Map<String, dynamic> $wrapMapHandleNull<K, V>(
88100
Map<K, V> source, dynamic converter(V key)) =>
89101
source == null ? null : new _MappingMap(source, converter);
90102

103+
/// Helper function used in generated code when
104+
/// `JsonSerializableGenerator.useWrappers` is `true`.
105+
///
106+
/// Should not be used directly.
91107
List<dynamic> $wrapList<T>(List<T> source, dynamic converter(T key)) =>
92108
new _MappingList(source, converter);
93109

110+
/// Helper function used in generated code when
111+
/// `JsonSerializableGenerator.useWrappers` is `true`.
112+
///
113+
/// Should not be used directly.
94114
List<dynamic> $wrapListHandleNull<T>(
95115
List<T> source, dynamic converter(T key)) =>
96116
source == null ? null : new _MappingList(source, converter);

json_annotation/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: json_annotation
2-
version: 0.2.3-dev
2+
version: 0.2.3
33
description: Annotations for the json_serializable package
44
homepage: https://github.com/dart-lang/json_serializable
55
author: Dart Team <misc@dartlang.org>

0 commit comments

Comments
 (0)