Skip to content

Home > @opengovsg/validators > createPathSchema

createPathSchema() function ​

Create a schema that validates user-supplied pathnames for filesystem operations.

Signature:

typescript
createPathSchema: (options: PathValidatorOptions) => z.ZodType<string>

Parameters ​

ParameterTypeDescription
optionsPathValidatorOptionsThe options to use for validation

Returns:

z.ZodType<string>

A Zod schema that validates paths.

Exceptions ​

OptionsError If the options are invalid