diff --git a/packages/validate/README.md b/packages/validate/README.md index f7090962..4ef4a935 100644 --- a/packages/validate/README.md +++ b/packages/validate/README.md @@ -1,6 +1,8 @@ -# validate -[![Pub](https://img.shields.io/pub/v/angel_validate.svg)](https://pub.dartlang.org/packages/angel_validate) -[![build status](https://travis-ci.org/angel-dart/validate.svg)](https://travis-ci.org/angel-dart/validate) +# angel3_validate +[![version](https://img.shields.io/badge/pub-v2.12.4-brightgreen)](https://pub.dartlang.org/packages/angel3_validate) +[![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) + +[![License](https://img.shields.io/github/license/dukefirehawk/angel)](https://github.com/dukefirehawk/angel/tree/angel3/packages/validate/LICENSE) [Live Example](https://angel-dart.github.io/validate) @@ -33,7 +35,7 @@ For convenience's sake, this library also exports `matcher`. ## Creating a Validator ```dart -import 'package:angel_validate/angel_validate.dart'; +import 'package:angel3_validate/angel3_validate.dart'; main() { var validator = Validator({ @@ -144,7 +146,7 @@ main() { ``` # Custom Error Messages -If these are not present, `angel_validate` will *attempt* to generate +If these are not present, `angel3_validate` will *attempt* to generate a coherent error message on its own. ```dart @@ -286,8 +288,8 @@ main() { * `filterQuery(only)`: Same as `filterBody`, but operates on `req.query`. ```dart -import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_validate/server.dart'; +import 'package:angel3_framework/angel3_framework.dart'; +import 'package:angel3_validate/server.dart'; final Validator echo = Validator({ 'message*': (String message) => message.length >= 5 @@ -300,7 +302,7 @@ final Validator todo = Validator({ 'completed': false }); -main() async { +void main() async { var app = Angel(); app.chain([validate(echo)]).post('/echo', (req, res) async { diff --git a/packages/validate/example/main.dart b/packages/validate/example/main.dart index f9ed89b5..145945aa 100644 --- a/packages/validate/example/main.dart +++ b/packages/validate/example/main.dart @@ -1,6 +1,6 @@ -import 'package:angel_validate/angel_validate.dart'; +import 'package:angel3_validate/angel3_validate.dart'; -main() { +void main() { var bio = Validator({ 'age*': [isInt, greaterThanOrEqualTo(0)], 'birthYear*': isInt, diff --git a/packages/validate/lib/angel_validate.dart b/packages/validate/lib/angel3_validate.dart similarity index 94% rename from packages/validate/lib/angel_validate.dart rename to packages/validate/lib/angel3_validate.dart index 0fa2c34d..33bb43b4 100644 --- a/packages/validate/lib/angel_validate.dart +++ b/packages/validate/lib/angel3_validate.dart @@ -1,5 +1,5 @@ /// Cross-platform validation library based on `matcher`. -library angel_validate; +library angel3_validate; export 'package:matcher/matcher.dart'; export 'src/context_aware.dart'; diff --git a/packages/validate/lib/server.dart b/packages/validate/lib/server.dart index bbdedba2..3d201b60 100644 --- a/packages/validate/lib/server.dart +++ b/packages/validate/lib/server.dart @@ -1,13 +1,13 @@ /// Support for using `angel_validate` with the Angel Framework. -library angel_validate.server; +library angel3_validate.server; import 'dart:async'; -import 'package:angel_framework/angel_framework.dart'; +import 'package:angel3_framework/angel3_framework.dart'; import 'src/async.dart'; -import 'angel_validate.dart'; +import 'angel3_validate.dart'; export 'src/async.dart'; -export 'angel_validate.dart'; +export 'angel3_validate.dart'; /// Auto-parses numbers in `req.bodyAsMap`. RequestHandler autoParseBody(List fields) { diff --git a/packages/validate/lib/src/async.dart b/packages/validate/lib/src/async.dart index a45bdd92..b3a12435 100644 --- a/packages/validate/lib/src/async.dart +++ b/packages/validate/lib/src/async.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_http_exception/angel_http_exception.dart'; +import 'package:angel3_framework/angel3_framework.dart'; +import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:matcher/matcher.dart'; import 'context_aware.dart'; diff --git a/packages/validate/lib/src/validator.dart b/packages/validate/lib/src/validator.dart index 6faa8dfd..22532452 100644 --- a/packages/validate/lib/src/validator.dart +++ b/packages/validate/lib/src/validator.dart @@ -1,4 +1,4 @@ -import 'package:angel_http_exception/angel_http_exception.dart'; +import 'package:angel3_http_exception/angel3_http_exception.dart'; import 'package:matcher/matcher.dart'; import 'context_aware.dart'; import 'context_validator.dart'; diff --git a/packages/validate/pubspec.yaml b/packages/validate/pubspec.yaml index da86be32..deb4179c 100644 --- a/packages/validate/pubspec.yaml +++ b/packages/validate/pubspec.yaml @@ -1,31 +1,18 @@ -name: angel_validate +name: angel3_validate description: Cross-platform request body validation library based on `matcher`. version: 4.0.0 -homepage: https://github.com/angel-dart/validate -publish_to: none +homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/validate environment: sdk: '>=2.12.0 <3.0.0' dependencies: - angel_framework: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/framework - angel_http_exception: - git: - url: https://github.com/dukefirehawk/angel.git - ref: sdk-2.12.x_nnbd - path: packages/http_exception + angel3_framework: ^4.0.0 + angel3_http_exception: ^3.0.0 matcher: ^0.12.0 dev_dependencies: - #angel_test: - # git: - # url: https://github.com/dukefirehawk/angel.git - # ref: sdk-2.12.x - # path: packages/test + #angel3_test: build_runner: ^1.11.1 build_web_compilers: ^2.12.2 - # logging: ^0.11.0 - # mock_request: + logging: ^1.0.1 + angel3_mock_request: ^2.0.0 pedantic: ^1.0.0 - test: ^1.15.7 \ No newline at end of file + test: ^1.17.4 \ No newline at end of file diff --git a/packages/validate/test/basic_test.dart b/packages/validate/test/basic_test.dart index ac415bcf..031f7392 100644 --- a/packages/validate/test/basic_test.dart +++ b/packages/validate/test/basic_test.dart @@ -1,4 +1,4 @@ -import 'package:angel_validate/angel_validate.dart'; +import 'package:angel3_validate/angel3_validate.dart'; import 'package:test/test.dart'; final Validator emailSchema = diff --git a/packages/validate/test/server_test.dart b/packages/validate/test/server_test.dart index 0b32491b..26de6490 100644 --- a/packages/validate/test/server_test.dart +++ b/packages/validate/test/server_test.dart @@ -1,12 +1,12 @@ import 'dart:async'; import 'dart:convert'; -import 'package:angel_framework/angel_framework.dart'; -import 'package:angel_framework/http.dart'; +import 'package:angel3_framework/angel3_framework.dart'; +import 'package:angel3_framework/http.dart'; //import 'package:angel_test/angel_test.dart'; -import 'package:angel_validate/server.dart'; +import 'package:angel3_validate/server.dart'; import 'package:logging/logging.dart'; -import 'package:mock_request/mock_request.dart'; +import 'package:angel3_mock_request/angel3_mock_request.dart'; import 'package:test/test.dart'; final Validator echoSchema = Validator({'message*': isString}); diff --git a/packages/validate/web/main.dart b/packages/validate/web/main.dart index 92a52867..4039d11b 100644 --- a/packages/validate/web/main.dart +++ b/packages/validate/web/main.dart @@ -1,6 +1,6 @@ import 'dart:html'; -import 'package:angel_validate/angel_validate.dart'; +import 'package:angel3_validate/angel3_validate.dart'; final $errors = querySelector('#errors') as UListElement?; final $form = querySelector('#form') as FormElement?; @@ -28,7 +28,7 @@ final Validator formSchema = Validator({ "I told you to leave that field blank, but instead you typed '{{value}}'..." }); -main() { +void main() { $form!.onSubmit.listen((e) { e.preventDefault(); $errors!.children.clear();