Skip to content

Add Support for custom format input #250

@shivamkj

Description

@shivamkj

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Currently, if I call S.string().format('myformat'), it throws following error:

throw new FluentSchemaError(
FluentSchemaError: 'format' must be one of relative-json-pointer, json-pointer, uuid, regex, ipv6, ipv4, hostname, email, url, uri-template, uri-reference, uri, time, date, date-time

This makes it difficult to use any custom format with this library. We should provide option to customize this behavior to support custom formats.

Motivation

I am using ajv for validation, ajv supports adding custom user defined format - Format validation, which takes validate function in which one write any js code to validate the input. Now since this library only takes well defined formats, it's difficult to use this library with ajv.

Example

S.string().format('myformat')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions