Skip to content

v0.7.0

Choose a tag to compare

@github-actions github-actions released this 17 Sep 10:01
· 209 commits to main since this release

With a catalog, validate now checks every element's props.

Passing a catalog alongside validate — to <json-render>, to injectUIStream / injectChatUI, or to checkSpec — was documented to hold each element's props to its component's schema. It did not. The check relied on core's catalog.validate(spec), which applies a component's props schema only when the catalog has exactly one component, so any catalog with two or more — the Material catalog included — got its element shapes and type names checked and not a single prop. The props check is now this package's own.

const { issues, hasErrors } = checkSpec(spec, 'warn', { catalog });
// issues[0]: { severity: 'error', code: 'invalid_props', elementKey: 'title',
//              message: 'elements.title.props.level: …' }

What changes for your app

  • A literal prop that fails its component's schema is now an invalid_props error, naming the element and the path to the prop.
  • Under 'strict' such a spec no longer renders, and a generation that ends with one fails through onError instead of reaching onComplete. Under 'warn' it still renders; the issue is logged, and the hooks expose it in issues().
  • A prop written as an expression — $state, $bindState, $template, $cond, $computed, a directive — is not checked: it has no value until render time. A one-component catalog, whose props core did check, no longer reports expressions as invalid either.
  • A catalog schema that throws while checking counts as a rejection instead of crashing the check.
  • SpecCatalog gains an optional data field — the one createCatalog already returns — where the props schemas are read from. A catalog made by createCatalog needs no change.

With validate off (the default), or without a catalog, nothing changes.

Upgrading

npm i ngx-json-render@0.7.0 ngx-json-render-material@0.3.4

Install both: the catalog's peer range moves to ^0.7.0, and npm resolves a mismatched pair by quietly picking an older renderer.

If you use 'strict' with a catalog, first run a few specs you store or generate through checkSpec(spec, 'warn', { catalog }). Every invalid_props it reports belongs to a spec 0.7.0 will not render.

Full Changelog: v0.6.0...v0.7.0