Closed mbossenbroek closed 8 years ago
Sequence schemas must follow the syntax [one* optional* rest-schema?]
. This is to allow greedy matching without backtracking. Otherwise, e.g., with the schema you provide, it's ambiguous whether 'bar
should be validated against the first schema or the second schema.
Could you update the docstring for the relevant operators (one
& optional
) to reflect that limitation? It's also very unclear from the error message that it was an issue with the schema construction itself and not what it was validating.
Sure, when we can. PR also very welcome. Thanks.
On Wed, Oct 14, 2015, 12:52 PM Matt Bossenbroek notifications@github.com wrote:
Could you update the docstring for the relevant operators (one & optional) to reflect that limitation? It's also very unclear from the error message that it was an issue with the schema construction itself and not what it was validating.
— Reply to this email directly or view it on GitHub https://github.com/Prismatic/schema/issues/289#issuecomment-148134802.
Thanks! Appreciate it!
This works:
But this doesn't: