Skip to main content

dox_builder 3.2.2 copy "dox_builder: ^3.2.2" to clipboard
dox_builder: ^3.2.2 copied to clipboard

Dox builder for dox framework

dox_builder #

Code generator for Dox apps. It runs with build_runner.

pub package license: MIT

Part of Dox, a web backend framework for Dart. Source code: github.com/dartondox/dox.

Install #

Add it as a dev dependency. A new app made with dox create already has it.

dart pub add dev:dox_builder dev:build_runner

To see what is ready and what may still change, read Status and roadmap.

How it is used #

You do not call this package from your code. Run the generator:

dart run build_runner build      # or: dox build_runner:build
dart run build_runner watch      # or: dox build_runner:watch

It writes:

  • The .g.dart part of each @DoxModel model (the <Name>Generator class).
  • The .g.dart part of each @Dto class ($<Name>Dto, the checks and the JSON Schema).
  • The .g.dart part of the @DoxEnv env class.
  • lib/generated/container.g.dart: every @Inject() class, router, provider and model binder, for AppConfig(container: registerContainer).
  • lib/generated/dtos.g.dart: every DTO of the app, for AppConfig(dtos: dtos). An app with no DTO gets an empty list.
  • lib/generated/openapi.g.dart: the OpenAPI docs, read from the routes, controllers, DTOs and models.
  • lib/generated/jobs.g.dart: every @Job() class, for QueueConfig(jobs: jobRegistry) of dox_queue. It also lists the mail jobs of dox_mailer when the app uses it. Only in an app with dox_queue in its pubspec.yaml.

A bad DTO (a field that is not final, a type that is not supported, a bad regex) stops the build with a clear error.

Documentation #

License #

MIT. See LICENSE.