Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

joi-to-md

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-to-md

Converts Joi Schemas into Markdown documentation

  • 1.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Usage

import Joi from "joi";
import joiToMd from "joi-to-md";

//Example JOI Schema
const schema = Joi.object({
  username: Joi.string()
    .alphanum()
    .min(3)
    .max(30)
    .required()
    .description("The username, can't get much simpler than that."),
  password: Joi.string()
    .pattern(new RegExp("^[a-zA-Z0-9]{3,30}$"))
    .description("The password for the user's account."),
  birth_year: Joi.number()
    .integer()
    .min(1900)
    .max(2021)
    .required()
    .description("The year the user was born."),
  email: Joi.string()
    .email({
      minDomainSegments: 2,
      tlds: { allow: ["com", "net"] },
    })
    .optional()
    .description("The user's email address"),
  siblings: Joi.array().items(
    Joi.object({
      name: Joi.string().description("The name of the sibling"),
      birth_year: Joi.number()
        .integer()
        .min(1900)
        .max(2021)
        .description("The year the sibling was born"),
    })
  ),
})
  .with("username", "birth_year")
  .xor("password", "access_token")
  .with("password", "repeat_password");

console.log(joiToMd(schema));

FAQs

Package last updated on 19 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc