
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@appear.sh/oas-zod-validator
Advanced tools
The open-source OpenAPI Spec Validator using Zod. From Appear.
Learn more »
Appear site
·
Issues
·
OSS API Schema Validator tool
A robust OpenAPI Specification (OAS) validator built with Zod, providing type-safe schema validation for both OAS 3.0.x and 3.1 specifications.
npx @appear.sh/oas-zod-validator path/to/your/spec.json
npm install @appear.sh/oas-zod-validator
import { validateOpenAPI } from '@appear.sh/oas-zod-validator';
// Validate an OpenAPI spec (JSON or YAML)
const result = validateOpenAPI({
openapi: '3.0.0',
info: {
title: 'My API',
version: '1.0.0',
},
paths: {
'/hello': {
get: {
responses: {
'200': {
description: 'Success',
},
},
},
},
},
});
if (result.valid) {
console.log('✅ Valid OpenAPI specification');
} else {
console.error('❌ Validation errors:', result.errors);
}
# Install globally
npm install -g @appear.sh/oas-zod-validator
# Validate a spec file
oas-validate api.yaml
# With strict validation options
oas-validate --strict --rate-limits api.json
# Interactive mode with guidance
oas-validate --interactive
# JSON output for CI/CD pipelines
oas-validate --json api.yaml
Caching is enabled by default and significantly improves performance for repeated validations of the same specification:
// Validate with default caching (enabled)
const result = validateOpenAPI(spec);
// Disable caching if needed
const resultNoCache = validateOpenAPI(spec, {
cache: { enabled: false },
});
// Configure cache size
const resultWithLargeCache = validateOpenAPI(spec, {
cache: { maxSize: 1000 },
});
// Reset the cache manually
import { resetCache } from '@appear.sh/oas-zod-validator';
resetCache();
// Configure the global cache
import { configureCache } from '@appear.sh/oas-zod-validator';
configureCache({ maxSize: 2000 });
The caching system optimizes:
This is particularly beneficial for:
// Define custom format validators
const phoneValidator = (value: string) => {
return /^\+[1-9]\d{1,14}$/.test(value);
};
// Use in validation
const result = validateOpenAPI(spec, {
customFormats: {
phone: phoneValidator,
},
});
const result = validateOpenAPI(spec, {
strict: true,
allowFutureOASVersions: true,
strictRules: {
requireRateLimitHeaders: true,
},
customFormats: {
phone: phoneValidator,
},
});
Create .oas-validate.json
for persistent options:
{
"strict": true,
"allowFutureOASVersions": false,
"requireRateLimitHeaders": true,
"format": "pretty"
}
For very large specs (multi‑MB), the validator provides options to reduce CPU and memory while preserving correctness:
fastMode
: Enables structural validation and skips heavy checks. Equivalent to enabling skipExamples
and skipPatternChecks
.noLocation
: Skips computing source locations; avoids building ASTs/Document for files (big speedup on large files).autoFastThresholdBytes
: Auto‑enable fast mode when content size exceeds this threshold. Defaults to ~15 MiB.maxErrors
: Cap the number of reported issues. Useful to short‑circuit runaway errors in huge inputs.skipExamples
: Skip validating example
values.skipPatternChecks
: Skip expensive regex validations.CLI flags:
--fast
, --no-location
, --max-errors <n>
, --auto-fast-threshold <bytes>
, --skip-examples
, --skip-pattern-checks
, --quiet
.Caching:
$ref
targets are cached with a true LRU.getValidationCache
for knobs.# Install dependencies
npm install
# Run tests (uses Vitest)
npm test
# Run tests in verbose mode (uses Vitest)
VERBOSE_INTEGRATION=1 npm test
# Watch mode for development
npm run test:watch
# Build
npm run build
This project uses TypeScript with ESM modules and Vitest for testing. It follows strict coding practices and maintains high test coverage.
Contributions are welcome! Please follow these steps:
npm test
).npm run changeset
Follow the prompts:
oas-zod-validator
as the package.CHANGELOG.md
..changeset/
directory (e.g., .changeset/sweet-donkeys-cry.md
).main
branch.Maintainers will handle the versioning and release process using the changeset files provided in merged Pull Requests.
For bug reports, feature requests, or contributions, please visit the GitHub repository.
FAQs
OpenAPI Specification validator built with Zod
The npm package @appear.sh/oas-zod-validator receives a total of 38 weekly downloads. As such, @appear.sh/oas-zod-validator popularity was classified as not popular.
We found that @appear.sh/oas-zod-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.