Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/helightdev/dogs
an object mapping and serialization library that uses code generation to create a structure definition of your serializable classes, which is usable at runtime.
https://github.com/helightdev/dogs
dart dataclass generator json object-mapper odm serialization
Last synced: 16 days ago
JSON representation
an object mapping and serialization library that uses code generation to create a structure definition of your serializable classes, which is usable at runtime.
- Host: GitHub
- URL: https://github.com/helightdev/dogs
- Owner: helightdev
- License: apache-2.0
- Created: 2023-01-05T22:11:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-23T03:34:41.000Z (about 2 months ago)
- Last Synced: 2024-10-20T06:58:18.886Z (26 days ago)
- Topics: dart, dataclass, generator, json, object-mapper, odm, serialization
- Language: Dart
- Homepage: https://dogs.helight.dev
- Size: 3.47 MB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Authors: AUTHORS
Awesome Lists containing this project
README
Dart Object Graphs
DOGs, short for Dart Object Graphs, is a object mapping and serialization library that use
code generation to create a structure definition of your serializable classes, which is usable at
runtime.[Documentation](https://dogs.helight.dev) |
[Discord](https://discord.gg/6HKuGSzYKJ) |
[Pub Package](https://pub.dev/packages/dogs_core)```dart
@serializable
class Person with Dataclass{@LengthRange(max: 128)
final String name;@Minimum(18)
final int age;@SizeRange(max: 16)
@Regex("((_)?[a-z]+[A-Za-z0-9]*)+")
final Set? tags;Person(this.name, this.age, this.tags);
}
```* 🐦 **Concise** Write expressive code with effectively zero boilerplate
* 🚀 **Fast** Similar or increased performance compared to alternatives
* 🧩 **Extensible** Modify and customize any part of your serialization
* 📦 **Adaptive** Use one of the various formats or bring your own
* 📚 **Documented** Comprehensive documentation and examples
* ⚡ **Unmatched DX** No part files, no dollar signs, no getters, no hassle## Format Support
- **JSON** (included in dogs_core)
- **YAML**
- **TOML**
- **CBOR**## Core Package
- **Json**
The core package comes with json support out of the box and requires no additional dependencies.- **Builders**
We provide autogenerated builders, similar to built_value, which allow you to easily create
immutable objects with a fluent api.- **Dataclasses**
Using our dataclass mixin automatically implements toString, equals and hashCode for your
serializable classes. This removes the requirement for a package like equatable or
ungodly amounts of boilerplate code.- **Projections**
Dogs offers a powerful projection api, which allows you to transform your objects into
other objects, without having to write additional boilerplate code.- **Polymorphism**
Dogs supports polymorphic serialization, which allows you to serialize and deserialize
objects of different types. You can even use interfaces and abstract classes as types,
including `Object`.- **Validation**
Using the validation api, you can easily validate your objects, without having the struggle
of writing your own validation logic for most common use cases.- **OpenApi Schema** (preview)
Dogs offers a schema generation api, which allows you to generate an OpenApi schema for your
objects, to be used with OpenApi tools like Swagger.[Package on pub.dev](https://pub.dev/packages/dogs_core)
[Documentation](https://dogs.helight.dev)## Firestore
Dogs offers a firestore api, which allows you to easily create firestore documents from your
serializable objects and vice versa. You can either use our lightweight extensions on the Firestore
classes or make use of our entity api, which offers you a simplified and more object oriented way of
interacting with firestore.
[Package on pub.dev](https://pub.dev/packages/dogs_firestore)
[Documentation](https://dogs.helight.dev/firestore/)## Forms
Use our forms api to easily create forms for any serializable object, without having
to write boilerplate code. The package uses flutter_form_builder under the hood, so you can
benefit from its large ecosystem of form fields.
[Package on pub.dev](https://pub.dev/packages/dogs_forms)
[Documentation](https://dogs.helight.dev/forms/)## ✨ Fancy Code Generation ✨
Dogs doesn't use part files for generated code but instead
generated files for all serializable classes, which then get exported in the
dogs.g.dart file at the root of your lib folder. This massively improves the
developer experience, as you **don't** have to write **annoying part statements** with
missing files everytime. In fact, you don't need do **import anything generated** in
your **model files** at all! Generally, the api of dogs is designed to be independent
of generated code, where it makes sense. All serialization and deserialization
methods don't require any reference to generated code and can be used without
any imports. The only exception to this are the builders, which are generated
for each serializable class and require the dogs.g.dart file to be imported.