Skip to content

Registering new URL Type #405

@Rob-pw

Description

@Rob-pw

Hi, first I must apologise if this isn't 'issue worthy'.

In Joi v1, it is possible to register a 'Type' with the Types Registry. The example in the npm codebase demonstrates this as:

var IntDef = _.extends({}, Number, function () {

    // Constructor
    return this.integer();
});

Types.set("Int", IntDef);
var Int = Types.Int;

I would like to register an AbsoluteURL type, or more simply, validate a URL through Joi.

The ways I can see this happening are:

  • function passed as a parameter which validates a given value
  • extending an existing type: any, string, email, etc.
  • registering a new type

In my research, I have not yet found a solution to this.

Thanks,
Rob.

Metadata

Metadata

Assignees

Labels

supportQuestions, discussions, and general support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions