This simple example can be a reference to adapt composable-functions to any other parser library.
There are two approaches to use composable-functions with a custom parser:
- Create an adapter function that will receive a schema and return a schema in the shape of a
ParserSchena
. Example: theadapt
function. This is our preferred approach and we wrote a post about it. - Create your custom
applySchema
that will validate your input and context and return aResult
. Example: theapplyArkSchema
function.
Check out the ./src
directory to understand how we implemented both approaches with arktype
.