Skip to content

Support schemas with recursive references #63

@jacksmith15

Description

@jacksmith15

There are several issues with this.

  1. The parser needs to be able to handle infinite schemas. This likely means instantiating default elements and keeping track of them, and then recursing through and setting attributes. There is a POC of this in feature/recursive-schema.
  2. The orderer needs to be able to identify cycles, and either annotate them for manual resolution in the output or resolve them as is.
  3. The DSL itself needs to be able to handle infinite recursion. This chiefly causes problems in places with default values. If the default value is the element with no arguments, but some properties have defaults, then instantiating with no arguments will trigger an infinite recursion.

What is the correct way to write recursive schemas in the DSL?

class TreeNode(Object):
    parent = Property(Element())

TreeNode.properties["value"].element = TreeNode

or maybe

class TreeNode(Object):
    parent = Property(lambda: TreeNode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions