# joi-to-md

> Converts Joi Schemas into Markdown documentation

Latest version **1.1.3** (published 2022-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install joi-to-md
pnpm add joi-to-md
yarn add joi-to-md
bun add joi-to-md
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2022-04-19 |
| First published | 2022-04-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jmcudd |

## Links

- npm: https://www.npmjs.com/package/joi-to-md
- Homepage: https://github.com/jmcudd/joi-to-md
- npm.io page: https://npm.io/package/joi-to-md

## Dependencies (3)

- [esm](https://npm.io/package/esm.md) ^3.2.25
- [joi](https://npm.io/package/joi.md) ^17.4.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Recent versions

- 1.1.3 (latest) — 2022-04-19

## README

# 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));
```

---
_Source: https://npm.io/package/joi-to-md · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
