question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support recursive schemas

See original GitHub issue

Hi there! Just wondering if it’s presently possible to have a recursive schema – a schema that references itself.

const RecursiveSchema = new SimpleSchema({
  field: { type: String },
  children: { type: Array },
  'children.$': { type: RecursiveSchema }
});

Obviously, this won’t work (the JavaScript won’t even allow it). I was just wondering if anyone had a way to do something like this.

Thanks!

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
jmarks-joshuacommented, Mar 15, 2018

Yeah i know thats why i mentioned it, it’s just pretty grim code, but it’s probably what i’ll end up doing. I was trying to think of a way to do it in simple-schema but i think i’d take me a while to get a handle on exactly how it all works.

1reaction
aldeedcommented, Mar 15, 2018

I reopened this as a feature request. If anyone wants it badly enough, please submit a pull request

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support for recursive schemas #96 - metosin/malli - GitHub
Does it have support for recursive schemas? I was trying to generate malli schemas from json-schemas (#54)
Read more >
Recursive schema extension — jschon 0.10.0 documentation
Recursive schema extension . The following script implements the recursive schema extension example, described in the JSON Schema 2020-12 core specification.
Read more >
JSON Schema - Recursive Schema Definition - Stack Overflow
Yes, your schema will work. The "$ref": "#" points back to the root of the schema document. However, the "type": "object" is useless:...
Read more >
Combining schemas - Ajv JSON schema validator
References can be recursive (and mutually recursive) to implement the schemas for different data structures (such as linked lists, trees, graphs, etc.). You...
Read more >
How to create recursive schema - JSON Forms community
I'm trying to create recursive schema, but it does not work. Does jsonform support recursive schemas? If yes do i have mistake in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found