Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@redocly/openapi-core
Advanced tools
@redocly/openapi-core is a powerful tool for working with OpenAPI definitions. It provides functionalities for validating, bundling, and transforming OpenAPI documents, making it easier to manage and maintain API specifications.
Validation
This feature allows you to validate an OpenAPI document to ensure it adheres to the OpenAPI specification. The code sample demonstrates how to use the `validate` function to check an OpenAPI document.
const { validate } = require('@redocly/openapi-core');
async function validateOpenAPIDocument(document) {
const result = await validate({ definition: document });
console.log(result);
}
const openAPIDocument = { /* your OpenAPI document here */ };
validateOpenAPIDocument(openAPIDocument);
Bundling
This feature allows you to bundle multiple OpenAPI files into a single document. The code sample demonstrates how to use the `bundle` function to combine an OpenAPI document.
const { bundle } = require('@redocly/openapi-core');
async function bundleOpenAPIDocument(document) {
const result = await bundle({ definition: document });
console.log(result);
}
const openAPIDocument = { /* your OpenAPI document here */ };
bundleOpenAPIDocument(openAPIDocument);
Transforming
This feature allows you to transform an OpenAPI document based on specific options. The code sample demonstrates how to use the `transform` function to modify an OpenAPI document.
const { transform } = require('@redocly/openapi-core');
async function transformOpenAPIDocument(document, options) {
const result = await transform({ definition: document, ...options });
console.log(result);
}
const openAPIDocument = { /* your OpenAPI document here */ };
const transformOptions = { /* your transformation options here */ };
transformOpenAPIDocument(openAPIDocument, transformOptions);
swagger-parser is a powerful tool for parsing, validating, and dereferencing Swagger and OpenAPI documents. It provides similar functionalities to @redocly/openapi-core, such as validation and dereferencing, but it does not offer as extensive transformation capabilities.
openapi-validator is a package focused on validating OpenAPI documents. It provides comprehensive validation features but lacks the bundling and transformation functionalities offered by @redocly/openapi-core.
swagger-jsdoc is a tool for generating Swagger (OpenAPI) definitions from JSDoc comments in your code. While it focuses on generating OpenAPI documents rather than validating or transforming them, it can be used in conjunction with @redocly/openapi-core for a complete workflow.
See https://github.com/Redocly/redocly-cli
import { formatProblems, lint, loadConfig } from '@redocly/openapi-core';
const pathToApi = 'openapi.yaml';
const config = loadConfig({ configPath: 'optional/path/to/.redocly.yaml' });
const lintResults = await lint({ ref: pathToApi, config });
import { formatProblems, bundle, loadConfig } from '@redocly/openapi-core';
const pathToApi = 'openapi.yaml';
const config = loadConfig({ configPath: 'optional/path/to/.redocly.yaml' });
const { bundle, problems } = await bundle({ ref: pathToApi, config });
FAQs
See https://github.com/Redocly/redocly-cli
The npm package @redocly/openapi-core receives a total of 1,084,834 weekly downloads. As such, @redocly/openapi-core popularity was classified as popular.
We found that @redocly/openapi-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.