tv4
tv4 copied to clipboard
Support recursive schemas
Given a schema like:
Tree:
type: object
required:
- children
properties:
children:
type: array
items:
$ref: '#/Tree'
The parser chokes, specifically being unable to normalize
and search
the stored maps. If we could detect the circularity and shirt-circuit it then the schema could support these types.
I've got some code changes that check for recursive schemas in arrays by investigating the keys present on the schema.['items']
compared to the current schema
, but would love a better check. Is there something native/a polyfill which determines object equality based on keys and value shapes? checking schema
vs schema['items']
is logically what we want to do but the objects don't reference compare correctly.