liquid_codegen 0.1.2
liquid_codegen: ^0.1.2 copied to clipboard
Optional YAML → typed LiquidEvent codegen for liquid_analytics. Generates sealed-class compatible event classes with no build_runner required.
Changelog #
0.1.2 #
Input validation, so a bad schema fails as a parse error instead of as generated Dart that will not compile — or, in the worst case, that will.
- An unknown
categoryis rejected by name, listing the valid ones. It was previously interpolated straight intoConsentCategory.<value>and left for the Dart compiler to complain about. The category list is mirrored as strings, since this package deliberately does not depend onliquid_analytics. - Event names, property names and types are validated. Names must convert cleanly into a Dart identifier, and types are checked against a deliberately narrow subset of Dart type syntax because the string is interpolated into a field declaration. Nothing that could break out of the string literal or doc comment it lands in now reaches the generator.
generateEventsLibraryescapes',\,$and newlines independently of the parser. It is public API and can be handed a schema built by other means, where an unescaped quote would close the literal early and a$would interpolate into the generated source.
A schema that relied on any of the newly rejected input was already producing broken output, so this is a patch rather than a breaking release.
0.1.1 #
- Add an
example/demonstrating the YAML schema and generated output.
0.1.0 #
- Initial release of
liquid_codegen.