Fix name collision with error type in latest `package:json_annotation`

Update checks in GitDependency to use new features
diff --git a/pkgs/pubspec_parse/CHANGELOG.md b/pkgs/pubspec_parse/CHANGELOG.md
index 951a5a3..4fc410a 100644
--- a/pkgs/pubspec_parse/CHANGELOG.md
+++ b/pkgs/pubspec_parse/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.1.1
+
+- Fixed name collision with error type in latest `package:json_annotation`.
+
 ## 0.1.0
 
 - Initial release.
diff --git a/pkgs/pubspec_parse/lib/src/dependency.dart b/pkgs/pubspec_parse/lib/src/dependency.dart
index a66c9c4..dd66d93 100644
--- a/pkgs/pubspec_parse/lib/src/dependency.dart
+++ b/pkgs/pubspec_parse/lib/src/dependency.dart
@@ -4,7 +4,6 @@
 
 import 'package:json_annotation/json_annotation.dart';
 import 'package:pub_semver/pub_semver.dart';
-import 'package:pubspec_parse/src/errors.dart';
 
 part 'dependency.g.dart';
 
@@ -101,16 +100,12 @@
 
 @JsonSerializable(createToJson: false)
 class GitDependency extends Dependency {
-  @JsonKey(fromJson: _parseUri)
+  @JsonKey(fromJson: _parseUri, required: true, disallowNullValue: true)
   final Uri url;
   final String ref;
   final String path;
 
-  GitDependency(this.url, this.ref, this.path) : super._() {
-    if (url == null) {
-      throw new ArgumentError.value(url, 'url', '"url" cannot be null.');
-    }
-  }
+  GitDependency(this.url, this.ref, this.path) : super._();
 
   factory GitDependency.fromData(Object data) {
     if (data is String) {
@@ -118,12 +113,6 @@
     }
 
     if (data is Map) {
-      // TODO: Need JsonKey.required
-      // https://github.com/dart-lang/json_serializable/issues/216
-      if (!data.containsKey('url')) {
-        throw new BadKeyException(data, 'url', '"url" is required.');
-      }
-
       return _$GitDependencyFromJson(data);
     }
 
diff --git a/pkgs/pubspec_parse/lib/src/dependency.g.dart b/pkgs/pubspec_parse/lib/src/dependency.g.dart
index f3dc23d..620bde7 100644
--- a/pkgs/pubspec_parse/lib/src/dependency.g.dart
+++ b/pkgs/pubspec_parse/lib/src/dependency.g.dart
@@ -22,6 +22,8 @@
 
 GitDependency _$GitDependencyFromJson(Map json) {
   return $checkedNew('GitDependency', json, () {
+    $checkKeys(json,
+        requiredKeys: const ['url'], disallowNullValues: const ['url']);
     var val = new GitDependency(
         $checkedConvert(
             json, 'url', (v) => v == null ? null : _parseUri(v as String)),
diff --git a/pkgs/pubspec_parse/lib/src/errors.dart b/pkgs/pubspec_parse/lib/src/errors.dart
index dbdc947..c9643b8 100644
--- a/pkgs/pubspec_parse/lib/src/errors.dart
+++ b/pkgs/pubspec_parse/lib/src/errors.dart
@@ -11,7 +11,7 @@
 ParsedYamlException parsedYamlExceptionFromError(
     CheckedFromJsonException error, StackTrace stack) {
   var innerError = error.innerError;
-  if (innerError is BadKeyException) {
+  if (innerError is InvalidKeyException) {
     var map = innerError.map;
     if (map is YamlMap) {
       // if the associated key exists, use that as the error node,
@@ -77,10 +77,10 @@
 ///
 /// Used instead of [CheckedFromJsonException] when highlighting a bad [key]
 /// is desired, instead of the associated value.
-class BadKeyException implements Exception {
+class InvalidKeyException implements Exception {
   final Map map;
   final String key;
   final String message;
 
-  BadKeyException(this.map, this.key, this.message);
+  InvalidKeyException(this.map, this.key, this.message);
 }
diff --git a/pkgs/pubspec_parse/lib/src/pubspec.dart b/pkgs/pubspec_parse/lib/src/pubspec.dart
index 169e719..7cc1ee1 100644
--- a/pkgs/pubspec_parse/lib/src/pubspec.dart
+++ b/pkgs/pubspec_parse/lib/src/pubspec.dart
@@ -120,7 +120,7 @@
       if (key == 'dart') {
         // github.com/dart-lang/pub/blob/d84173eeb03c3/lib/src/pubspec.dart#L342
         // 'dart' is not allowed as a key!
-        throw new BadKeyException(
+        throw new InvalidKeyException(
             source, 'dart', 'Use "sdk" to for Dart SDK constraints.');
       }
 
diff --git a/pkgs/pubspec_parse/pubspec.yaml b/pkgs/pubspec_parse/pubspec.yaml
index 4579c9b..6814fb6 100644
--- a/pkgs/pubspec_parse/pubspec.yaml
+++ b/pkgs/pubspec_parse/pubspec.yaml
@@ -2,7 +2,7 @@
 description: >-
   Simple package for parsing pubspec.yaml files with a type-safe API and rich
   error reporting.
-version: 0.1.0
+version: 0.1.1-dev
 homepage: https://github.com/dart-lang/pubspec_parse
 author: Dart Team <misc@dartlang.org>
 
@@ -10,13 +10,13 @@
   sdk: '>=2.0.0-dev.54 <2.0.0'
 
 dependencies:
-  json_annotation: ^0.2.7
+  json_annotation: ^0.2.8
   pub_semver: ^1.3.2
   yaml: ^2.1.12
 
 dev_dependencies:
   build_runner: ^0.8.0
-  json_serializable: ^0.5.6
+  json_serializable: ^0.5.7
   path: ^1.5.1
   stack_trace: ^1.9.2
   test: ^0.12.0
diff --git a/pkgs/pubspec_parse/test/dependency_test.dart b/pkgs/pubspec_parse/test/dependency_test.dart
index 9a42a64..527b310 100644
--- a/pkgs/pubspec_parse/test/dependency_test.dart
+++ b/pkgs/pubspec_parse/test/dependency_test.dart
@@ -130,7 +130,7 @@
 
   test('git - empty map', () {
     _expectThrows({'git': {}}, r'''
-line 5, column 11: "url" is required.
+line 5, column 11: Required keys are missing: url.
    "git": {}
           ^^''');
   });
@@ -139,7 +139,7 @@
     _expectThrows({
       'git': {'url': null}
     }, r'''
-line 6, column 12: "url" cannot be null.
+line 6, column 12: These keys had `null` values, which is not allowed: [url]
     "url": null
            ^^^^^''');
   });