Skip to content

UnrecognizedKeysException: small improvements to message value #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions json_annotation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.7+1

* Small improvement to `UnrecognizedKeysException.message` output and
documentation comments.

## 0.2.7

* Added `JsonSerializable.disallowUnrecognizedKeys`.
Expand Down
6 changes: 3 additions & 3 deletions json_annotation/lib/src/allowed_keys_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void $checkAllowedKeys(Map map, Iterable<String> allowedKeys) {
}
}

/// Exception thrown if there is an unrecognized key in a json map that was
/// Exception thrown if there are unrecognized keys in a JSON map that was
/// provided during deserialization.
class UnrecognizedKeysException implements Exception {
/// The allowed keys for [map].
Expand All @@ -24,12 +24,12 @@ class UnrecognizedKeysException implements Exception {
/// The keys from [map] that were unrecognized.
final List<String> unrecognizedKeys;

/// The source [Map] that the key was found in.
/// The source [Map] that the unrecognized keys were found in.
final Map map;

/// A human-readable message corresponding to the error.
String get message =>
'Unrecognized keys [${unrecognizedKeys.join(', ')}], supported keys are '
'Unrecognized keys: [${unrecognizedKeys.join(', ')}]; supported keys: '
'[${allowedKeys.join(', ')}]';

UnrecognizedKeysException(this.unrecognizedKeys, this.map, this.allowedKeys);
Expand Down
2 changes: 1 addition & 1 deletion json_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_annotation
version: 0.2.7
version: 0.2.7+1
description: >-
Classes and helper functions that support JSON code generation via the
`json_serializable` package.
Expand Down