schemani 0.0.1-alpha.3 copy "schemani: ^0.0.1-alpha.3" to clipboard
schemani: ^0.0.1-alpha.3 copied to clipboard

Simple and extensible data schema validation.

schemani #

Simple and extensible data schema validation for Dart and Flutter. If you know Yup and Laravel Validation you will feel like home using this package.

Please note that the schemani/formini packages are under development. There are still some issues to resolve before this has any help for real use cases. #roadmap

Usage #

import 'package:schemani/schemani.dart';

main() {
  const userSchema = MapSchema({
    'name': [Required()],
    'email': [Required(), Email()],
  });

  try {
    userSchema.validate({
      'name': null,
      'email': 'foo example.org',
    });
  } on MapValidationException catch (e) {
    e.exceptions.forEach((field, exception) {
      print('$field => $exception');
    });
  }
}

Will throw MapValidationException only once combining the inner ValidationExceptions.

flutter: name => Required field
flutter: email => Invalid email address

Usage with formini #

Use schemani_formini package for validating formini values using schemas. Or just copy the one simple file to your project.

API reference #

https://pub.dev/documentation/schemani

Contributing #

Please open an issue or pull request in GitHub. Any help and feedback is much appreciated.

flutter pub pub run test

Licence #

MIT

Roadmap #

  • ListSchema
  • Rules
    • References to another fields inside a rule
    • More basic rules (min, max, between, url, etc...)
  • i18n ValidationException.toString()
  • Benchmarking
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Simple and extensible data schema validation.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on schemani