Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yannbertrand/convert-joi-to-json-schema
https://github.com/yannbertrand/convert-joi-to-json-schema
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/yannbertrand/convert-joi-to-json-schema
- Owner: yannbertrand
- License: mit
- Created: 2024-04-24T20:19:28.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-11-26T17:14:20.000Z (about 1 month ago)
- Last Synced: 2024-11-26T18:25:18.508Z (about 1 month ago)
- Language: JavaScript
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# convert-joi-to-json-schema
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)
[![Twitter: _YannBertrand](https://img.shields.io/twitter/follow/_YannBertrand.svg?style=social)](https://twitter.com/_YannBertrand)**Stability: 1 - Experimental**
Convert Joi schema to JSON schema
## How to use?
```js
const joiSchema = Joi.object({
address: Joi.object({
street: Joi.string(),
city: Joi.string(),
}),
});const jsonSchema = convertJoiToJsonSchema(joiSchema);
/**
{
type: 'object',
properties: {
address: {
type: 'object',
properties: {
street: { type: 'string' },
city: { type: 'string' },
},
additionalProperties: false,
},
},
additionalProperties: false,
}
*/
```