3.2.1 • Published 1 year ago

joi-openapi v3.2.1

Weekly downloads
870
License
MIT
Repository
github
Last release
1 year ago

joi-openapi

This is a fork of joi-to-openapi with some new options. In short, in this package I've added joi extensions as supported type.

Now the library support to outputs for converted joi: standard output and file.

examples

const Joi = require("joi");
const { convert } = require("joi-openapi");

let joi = Joi.extend((joi) => ({
  base: joi
    .string()
    .isoDate()
    .description("Date in ISO format"),
  name: "date_start",
  language: {},
  rules: [],
}));

console.log(convert(joi.date_start()));

will output

{
  "type": "string",
  "format": "date-time",
  "description": "Date in ISO format"
}

to write the output on a file

const Joi = require("joi");
const { convertToFile } = require("joi-openapi");

let joi = Joi.extend((joi) => ({
  base: joi
    .string()
    .isoDate()
    .description("Date in ISO format"),
  name: "date_start",
  language: {},
  rules: [],
}));

convertToFile(joi.date_start(), "./");

will output

{
  "type": "string",
  "format": "date-time",
  "description": "Date in ISO format"
}

in the date_start.json file (the file will be created by joi type plust json format).

3.2.1

1 year ago

3.2.0

1 year ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.5

1 year ago

3.1.4

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago