dotprompt 2.0.0
dotprompt: ^2.0.0 copied to clipboard
Dotprompt for Dart: parse and render .prompt files (YAML frontmatter + Handlebars templates) for Generative AI.
Changelog #
All notable changes to dotprompt-dart will be documented in this file.
[Unreleased] #
2.0.0 - 2026-10-04 #
Picoschema now follows the spec and behaves like the other runtimes. Schemas
that relied on the old Dart-only syntax, or on unknown names becoming $ref,
need updating.
Breaking changes #
-
Picoschema is strict. These now throw
PicoschemaException:Before (1.x) Now email(the email): stringemail: string, the emailtags: string[]tags(array): stringstatus: a | bstatus(enum): [a, b]wild(*): string(*): stringn: int(alsostr,bool, ...)n: integeraanda?in the same objectpick one -
Unknown named schemas throw instead of becoming
{"$ref": name}. Names are looked up inschemas/defineSchema, thenDotpromptOptions.schemaResolver(DotpromptandPicoschema.parseonly;toJsonSchemais sync and only seesschemas). Register schemas before converting prompts that use them. -
The
input: Name/output: Nameshorthand is parsed as{"$type": Name}(same asschema: Name) instead of{"$ref": Name}, sorenderMetadataresolves it. -
Picoschema.toJsonSchema'sschemasparameter is nowMap<String, Map<String, dynamic>>?(wasMap<String, dynamic>?). -
Picoschema.isPicoschemareturns true for anything that is not JSON Schema (it used to require a bare scalar value). JSON Schema is detected as in the other runtimes: a top-leveltypenaming a JSON Schema type or apropertiesmap, plus list-valuedtype/anyOf/oneOf/allOf/enum,$schemaand$ref. Calling it beforetoJsonSchemais no longer needed. -
DotpromptOptions.schemasanddefineSchematake JSON Schema (as in the other runtimes), not Picoschema. Registered schemas are inserted as-is; convert Picoschema withPicoschema.toJsonSchemafirst.
Fixed #
- Picoschema now follows the spec and the JavaScript reference implementation
(genkit-dart#562):
field(array[, desc]): type,field(object[, desc]):andfield(enum[, desc]): [...]produce arrays, objects and enums. Previously the parenthesized qualifier was treated as a description.(*)wildcards and every Picoschema form are always converted. Previously some schemas skipped conversion and were passed through raw.- Top-level JSON Schema (
type: string, a barepropertiesmap,anyOf,enum,type: [string, "null"], etc.) is passed through instead of being parsed as Picoschema. - Passed-through JSON Schema and resolved named schemas are deep copies, so editing the result never changes the input or registered schemas.
- A frontmatter schema with a
$typefield next to other fields is parsed as a Picoschema object instead of being collapsed to the$typevalue. x?: nullproduces{type: null}instead of{type: [null, null]}.a ?: stringproduces a property nameda, nota.- Named schemas are resolved via
DotpromptOptions.schemaResolveras well asschemas/defineSchema. - The
input: Name/output: Nameshorthand resolves the named schema. Previously it became a raw{"$ref": name}.
- The spec test runner now checks
outputand namedschemas, sospec/picoschema.yamlis actually enforced.
Added #
Picoschema.parse(schema, {schemas, schemaResolver}), an async variant oftoJsonSchemathat resolves named schemas through aSchemaResolver.
1.0.0 - 2026-08-25 #
Added #
renderMetadataandcompilenow accept an optionaladditionalMetadataargument that is merged on top of the prompt's parsed frontmatter (scalar fields override,configmap is shallow-merged with additional winning on conflict), matching the JavaScript reference implementation.
0.0.1 - 2026-01-30 #
Added #
- Initial release of Dotprompt for Dart
- YAML frontmatter parsing with
Parserclass - Handlebars-style templating using the pure-Dart
handlebars_dartlibrary - Picoschema to JSON Schema conversion
- Core types:
Message,Part,Role,DataArgument - Built-in helpers:
role,media,history,json,section,ifEquals,unlessEquals - Partial template support with resolver callbacks
- Tool and schema resolution
- Comprehensive error handling with custom exceptions
- Full spec test suite for cross-runtime conformance