FSharp.Data.JsonSchema
FSharp.Data.JsonSchema copied to clipboard
Question: How to add schema generator for recursive type?
Hello,
I have a recursive DU as part of my model:
type Node =
| Leaf of int
| Node of Node * Node
Currently the Schema Generator gets caught in an endless loop when asked to generate a Json Schema.
I would offer a PR however I'm not sure how to add this feature.
Thanks
That's an excellent question. I haven't attempted this. @Tarmil, do you have any suggestions?
Looks like the way to handle recursive types in JSON schemas is using $ref. I'm not familiar with how to do this with NJsonSchema though.