-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f97272c
commit 23c7269
Showing
2 changed files
with
13 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,25 @@ | ||
# Acanthis | ||
|
||
Acanthis is a Validation library heavily inspired by [Zod](https://github.com/colinhacks/zod). It is designed to be a simple, and easy to use validation library. | ||
|
||
## Features | ||
|
||
Acanthis is designed to be composable. Schemas can be composed together to create more complex schemas. | ||
|
||
Also Acanthis doesn't require any runtime dependencies, and makes use of a chainable API to create schemas. | ||
|
||
## Getting Started | ||
 | ||
|
||
To get started with Acanthis, you can install it using the following command: | ||
|
||
```bash | ||
dart pub add acanthis | ||
``` | ||
# Acanthis | ||
|
||
## Example | ||
Acanthis is a simple and easy to use validation library for Dart. It is inspired by [Zod](https://github.com/colinhacks/zod) although it is not a port of it. Acanthis is tailored to the Dart language and its features and is type-safe and composable. | ||
|
||
Here is a simple example of how to use Acanthis: | ||
[Get Started](hhttps://acanthis.serinus.app/introduction.html) | [Pub.dev](https://pub.dev/packages/acanthis) | ||
|
||
```dart | ||
import 'package:acanthis/acanthis.dart'; | ||
## Why Acanthis? | ||
|
||
void main() { | ||
final schema = object({ | ||
'name': string().min(3), | ||
'age': number().positive(), | ||
}); | ||
Acanthis provides validation for most of the Dart built-in types and allows you to create custom validators. | ||
|
||
final result = schema.tryParse({ | ||
'name': 'Francesco', | ||
'age': 59, | ||
}); | ||
But that's not all! Acanthis is designed to be composable, so you can create complex validators by combining simpler ones. | ||
|
||
/// The result is a AcanthisParseResult object | ||
/// that has the following properties: | ||
/// - success: A boolean that indicates if the parsing was successful or not. | ||
/// - value: The value of the parsing. If the parsing was successful, this will contain the parsed value. | ||
/// - errors: The errors of the parsing. If the parsing was unsuccessful, this will contain the errors of the parsing. | ||
## Contributions | ||
|
||
if (result.success) { | ||
print('The schema is valid!'); | ||
} else { | ||
print('The schema is invalid!'); | ||
} | ||
} | ||
``` | ||
Contributions are welcome! If you want to contribute to Acanthis, you can open a pull request on the [GitHub repository](https://github.com/francescovallone/acanthis/pulls) | ||
|
||
As you can see if you come from a Zod background, the API is very similar and should be familiar to you. | ||
## License | ||
|
||
## Contributions | ||
Acanthis is licensed under the MIT License. You can read the full license [here](https://github.com/francescovallone/acanthis/blob/main/LICENSE) | ||
|
||
Contributions are welcome! If you want to contribute to Acanthis, you can open a pull request on the [GitHub repository](https://github.com/francescovallone/acanthis/pulls) | ||
## Credits | ||
|
||
Acanthis is developed and maintained by [Avesbox](https://avesbox.com) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.