Skip to content

Feature Request: lazy once #1258

@rokoroku

Description

@rokoroku

Context

  • node version: 6.9
  • joi version: 10.6.1
const schema = Joi.lazy(() => Joi.any()).once()

Since fn for Joi.lazy(fn) should return joi schema, it's okay to be called once to avoid unnecessary overhead.

(+) My other need is describing lazily-loaded schema with Joi.describe().
If lazy.once() replace the schema as lazily loaded schema itself, we can now describe the lazy schema as well. (Could it be another feature request for Joi.describe()? )

Metadata

Metadata

Assignees

Labels

breaking changesChange that can breaking existing codefeatureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions