Enhancement: definitions support
DylanYoung opened this issue · comments
I'd like to see support for definitions and a parameter to control when they're used. Most simple would be to a threshold for how many "objects of the same structure" to see before converting them to a single definition and references.
This is something I'd be interested in encoding if you're amenable :)
I'm not entirely sure what you're asking for here. Could you elaborate or give some example of how you would want the API to behave?
Basically the idea is that if the same "subschema" is encountered more than X times, it would be encoded in the resulting schema as a definition and referenced where it appears (using $defs and $ref
), rather than being duplicated across the schema. Probably needs a bit more thought though as to how it behaves... Maybe it just depends on $defs
being defined in the seed schema, then any place that matches a definition uses a $ref
instead of inlining it?