dartvex_codegen 0.2.0
dartvex_codegen: ^0.2.0 copied to clipboard
CLI code generator for Convex backends. Generates type-safe Dart bindings from your Convex schema.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased] #
0.2.0 - 2026-06-12 #
Added #
- Tolerates raw
convex function-specdumps: absent ornullargs/returnsparse as the Convexanytype (a returns-less function generatesFuture<dynamic>; an unvalidated-args function takes aMap<String, dynamic>argument) instead of aborting generation. - Unknown/future Convex type tags and non-scalar literal values (such as
$integer-encoded bigint literals) degrade todynamicwith a warning instead of crashing the run. - Spec parse errors now name the offending function and field path
(
messages.ts:list → args → field "filters"). dartvex_codegen scrubsubcommand andscrubFunctionSpec: replace the real deployment URL in a function-spec dump with a placeholder before the file is committed.- Typed paginated query bindings: a query taking
paginationOptsand returning aPaginationResultshape generates aTypedConvexPaginatedQuery<PageItem>wrapper (typed page items when areturns:validator exists,Map<String, dynamic>items otherwise), exposingitems,stream,status,isDone,loadMore, andcancel. - Generated files carry an
ignore_for_fileline under the generated-code header, so projects that do not exclude the generated directory from analysis do not fail on unused generated helpers or imports.
Fixed #
- Encoding an optional field with a nullable composite type (for example
v.optional(v.union(v.id('users'), v.null()))) generated Dart that did not compile; nullable encodes now bind through a promoting switch expression. - Generated locals no longer collide with user argument names: arguments named
raw,value,subscription, orquery(for examplekv.set(key, value)or a paginatedsearch(query)) previously generated code that failed to compile. - A paginated query with an argument that sanitizes to
pageSizefalls back to a plain query method with a warning instead of declaring the parameter twice. - Unions of only null members (including
v.literal(null)) map toNullinstead of rendering an empty Dart enum, and nested nullable unions no longer emit invalidT??annotations. - NUL characters in string literals are escaped as
\x00; Dart has no\0escape, so the previous output silently matched the digit'0'. - Generated typed query subscriptions now include
TypedQueryLoading<T>and handledartvexQueryLoadingevents, keeping generated switches exhaustive withdartvex0.2.x. - CLI generation failures now return non-zero exit codes and print concise errors instead of leaking raw uncaught stack traces to callers.
- Escapes literal-union enum
fromJsonerror messages so literal values with quotes, dollars, or newlines do not generate invalid Dart source. - Escapes generated imports, Convex function names, and table names embedded in Dart string literals, so unusual but valid identifiers containing quotes, dollars, or control characters do not produce analyzer-broken bindings.
- Deduplicates repeated literal union members before rendering enum decoders, so
redundant validators cannot generate duplicate Dart
switchcases. - Rejects unsafe generated file paths from malformed function specs or stale manifests instead of writing or deleting files outside the configured output directory.
- Fails code generation when a generated Dart file cannot be formatted instead of emitting invalid source with only a warning.
- Rejects Convex table names that would generate duplicate
ConvexTableIdsubclasses inschema.dart. - Rejects generated API member name collisions before writing invalid Dart.
- Preserves existing camelCase boundaries in generated method and field names.
- Rejects missing
--outputpaths before path normalization.
Changed #
- Widen the
dartvexdev-dependency to^0.2.0for golden fixture validation. Generated output is unchanged. - Require Dart
^3.7.0, matching the minimum SDK required by thedart_styleformatter versions accepted by the CLI.
0.1.3 - 2026-04-30 #
Improved #
- Refreshed README metadata, logo links, installation snippets, and example commands for pub.dev.
0.1.2 - 2026-03-21 #
Improved #
- Added comprehensive dartdoc comments on all public API
- Added example file for pub.dev scoring