arktype
arktype copied to clipboard
Allow any `@ark/schema` Root as input for a union branch or morph endpoint
To ensure normalized strucutre, a UnionNode is not allowed to have UnionNode
children, and a MorphNode is not allowed to have a MorphNode
as it's in
or out
validator.
This is critical to how the type system works, but it would that normalization process should be handled internally when parsing definitions, meaning that a UnionSchema definition including other UnionSchemas as branches should be valid, as should a Morph of the same kind.
As is, we are forced to normalize this in other places to compensate for the lack of ability to normalize it centrally.
I've begun addressing this to some extent (e.g. allowing BaseRoot as an input for a UnionBranch), but it should be made much more general.