tv4 icon indicating copy to clipboard operation
tv4 copied to clipboard

Support recursive schemas

Open baronfel opened this issue 8 years ago • 1 comments

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.

baronfel avatar Feb 24 '17 20:02 baronfel

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.

baronfel avatar Feb 24 '17 20:02 baronfel