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

joi-openapi

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-openapi

Joi converter to openapi 3.0 standard

  • 3.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
603
decreased by-41.68%
Maintainers
1
Weekly downloads
 
Created
Source

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).

Keywords

FAQs

Package last updated on 14 Feb 2023

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