
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
swagger-to-joi-fork
Advanced tools
Swagger to Joi converter
Generates text for Joi definitions. Definitions could be stored to a file or run using eval
.
Example usage:
const swaggerToJoi = require('swagger-to-joi');
const joiTextObject = swaggerToJoi(swaggerRouteParametersInJson, components, version, options);
// process joiTextObject or store joi definitions to a file
// returning object contain separate definitions for path, query and body
Example:
const swaggerToJoi = require('swagger-to-joi');
const swagger = {
swagger: '2.0',
schema: {
body: {
type: "object",
required: ["apiVersion", "data"],
properties: {
apiVersion: { type: "string", enum: ["1.0"], example: "1.0" },
data: {
type: "object",
required: ["projectId", "organization", "value", "currencyCode"],
properties: {
projectId: { type: "string", example: "1234567" },
organization: { type: "string", example: "My Org" },
currencyCode: { type: "string", example: "EUR" },
value: { type: "number", example: 50000 },
},
},
},
}
}
const joiTextObject = swaggerToJoi(swaggerRouteParametersInJson);
console.log(joiTextObject);
/*
Outputs:
Joi.object({
apiVersion: Joi.valid("1.0").required(),
data: Joi.object({
projectId: Joi.string().required(),
organization: Joi.string().required(),
currencyCode: Joi.string().required(),
value: Joi.number().required(),
}),
})
*/
Used for openAPI 3.0.0. Components used in schema.
2.0
or 3.0.0
. default 3.0.0
.
singleQuote
- boolean - determines if you want to user ' or " quotes. Default: true.overrideKeys
- key-value object. E.g. { projectId: 'Project.id' }
. Will override all keys in any swagger definition where key in swagger will match keyname from the overide object.FAQs
Swagger to Joi schema converter
We found that swagger-to-joi-fork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.