Repository navigation
v0.7.0
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_propserror, 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 throughonErrorinstead of reachingonComplete. Under'warn'it still renders; the issue is logged, and the hooks expose it inissues(). - 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.
SpecCataloggains an optionaldatafield — the onecreateCatalogalready returns — where the props schemas are read from. A catalog made bycreateCatalogneeds 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.4Install 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