validate: update readme, do not export pkg:matcher

This commit is contained in:
Tobe O 2020-05-04 12:42:24 -04:00
parent 104b8da314
commit 6338abd79e
4 changed files with 18 additions and 13 deletions

View file

@ -3,12 +3,10 @@
[![build status](https://travis-ci.org/angel-dart/validate.svg)](https://travis-ci.org/angel-dart/validate)
Strongly-typed form handlers and validators for Angel.
Version `3.x` is a major improvement over `2.x`, though it does include breaking changes.
Validation library based on the `matcher` library, with Angel support.
Why re-invent the wheel, when you can use the same validators you already
use for tests?
For convenience's sake, this library also exports `matcher`.
`package:angel_validate` allows you to easily sanitize incoming data, and to deserialize
that data into Dart classes (usually using `package:angel_serialize`).
# Field
The basic unit is the `Field` class, which is a type-safe way to read
@ -23,6 +21,13 @@ app.get('/hello', (req, res) async {
});
```
A `Field` can also use `Matcher` objects from `package:matcher` (which you may recognize from
its usage in `package:test`):
```dart
var positiveNumberField = IntField('pos_num').match([isPositive]);
```
There are several included field types:
* `TextField`
* `BoolField`

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_framework/http.dart';
import 'package:angel_validate/angel_validate.dart';
@ -5,7 +7,7 @@ import 'package:http_parser/http_parser.dart';
import 'package:logging/logging.dart';
import 'package:pretty_logging/pretty_logging.dart';
main() async {
Future<void> main() async {
Logger.root
..level = Level.ALL
..onRecord.listen(prettyLog);

View file

@ -1,2 +1,5 @@
export 'package:matcher/matcher.dart';
export 'without_matcher.dart';
export 'src/common_fields.dart';
export 'src/field.dart';
export 'src/form.dart';
export 'src/form_renderer.dart';
export 'src/matchers.dart';

View file

@ -1,5 +0,0 @@
export 'src/common_fields.dart';
export 'src/field.dart';
export 'src/form.dart';
export 'src/form_renderer.dart';
export 'src/matchers.dart';