Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support schemas with recursive references #63

Open
jacksmith15 opened this issue Apr 9, 2020 · 1 comment
Open

Support schemas with recursive references #63

jacksmith15 opened this issue Apr 9, 2020 · 1 comment

Comments

@jacksmith15
Copy link
Owner

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)
@tanzimabsar
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants