schemantic_builder 0.1.0 copy "schemantic_builder: ^0.1.0" to clipboard
schemantic_builder: ^0.1.0 copied to clipboard

A code generator for schemantic that produces type-safe data classes and JSON schemas from abstract definitions.

Pub

The code generator for schemantic. It generates type-safe data classes and runtime-accessible JSON Schemas from abstract class definitions annotated with @Schema.

This package is a development-time dependency. The runtime API lives in the schemantic package.

Installation #

Add schemantic as a regular dependency, and schemantic_builder plus build_runner as dev dependencies:

dart pub add schemantic
dart pub add dev:schemantic_builder
dart pub add dev:build_runner

Usage #

  1. Define your schema using the @Schema annotation from package:schemantic:
import 'package:schemantic/schemantic.dart';

part 'user.g.dart';

@Schema()
abstract class $User {
  String get name;
  int? get age;
  bool get isAdmin;
}
  1. Run the build runner to generate the implementation:
dart run build_runner build

See the schemantic README for full documentation on the generated APIs.

0
likes
140
points
109
downloads

Documentation

API reference

Publisher

verified publishergenkit.dev

Weekly Downloads

A code generator for schemantic that produces type-safe data classes and JSON schemas from abstract definitions.

Repository (GitHub)
View/report issues
Contributing

License

Apache-2.0 (license)

Dependencies

analyzer, build, code_builder, dart_style, schemantic, source_gen

More

Packages that depend on schemantic_builder