
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mockingjar-lib
Advanced tools
A TypeScript library for AI-powered JSON mock data generation using schema-based configuration
A TypeScript library for AI-powered JSON schema creation and test data generation.
MockingJar Library is a TypeScript library that provides JSON schema creation and AI-powered data generation capabilities. Built with modern TypeScript, comprehensive testing, and integrated with Anthropic Claude AI, it enables developers to create complex JSON structures and generate realistic data through natural language prompts.
This library serves as the core engine for JSON schema manipulation, data generation, and validation, designed to be integrated into web applications, CLI tools, or other TypeScript/Node.js projects.
npm install mockingjar-lib
import { Generator, Schema, Validation } from 'mockingjar-lib';
// Define a schema
const userSchema = {
name: 'User',
description: 'User profile data',
fields: [
{
id: '1',
name: 'name',
type: 'text',
logic: { required: true, minLength: 2, maxLength: 50 }
},
{
id: '2',
name: 'email',
type: 'email',
logic: { required: true }
},
{
id: '3',
name: 'age',
type: 'number',
logic: { min: 18, max: 100 }
}
]
};
// Generate data using the Generator module
const result = await Generator.generate(
'your-anthropic-api-key',
userSchema,
'Generate realistic user data for a social media platform',
{
count: 5,
maxAttempts: 3,
enableFallback: true,
timeout: 60000
}
);
if (result.success) {
console.log('Generated data:', result.data);
console.log('Metadata:', result.metadata);
} else {
console.error('Generation failed:', result.errors);
}
import { Schema } from 'mockingjar-lib';
let mySchema = {
name: 'User',
fields: [
{
id: 'user-1',
name: 'name',
type: 'text',
logic: { required: true }
}
]
};
// Add a new field to the schema root
mySchema = Schema.add.field(mySchema);
// Add a field to an object (requires object field id)
mySchema = Schema.add.objectField('object-field-id', mySchema);
// Add a field to an array item object (requires array field id)
mySchema = Schema.add.arrayItemObjectField('array-field-id', mySchema);
// Update field type (requires field id and new type)
mySchema = Schema.update.fieldType(mySchema, 'field-id', 'email');
// Update array item field type (requires field id and new type)
mySchema = Schema.update.arrayItemFieldType(mySchema, 'array-field-id', 'number');
// Remove a field (requires field id)
mySchema = Schema.delete.field(mySchema, 'field-id');
// Convert schema to JSON preview
const jsonPreview = Schema.convert.schemaToJson(mySchema.fields, {
collapsedFields: new Set(['field-id-to-collapse']),
forPreview: true
});
// Convert JSON to schema
const convertedSchema = Schema.convert.jsonToSchema(
{ name: 'John', age: 30, email: 'john@example.com' },
'User Schema'
);
import { Validation } from 'mockingjar-lib';
const data = {
name: 'John Doe',
email: 'john@example.com',
age: 30
};
const errors = Validation.validate(data, userSchema);
if (errors.length === 0) {
console.log('Data is valid!');
} else {
console.log('Validation errors:', errors);
// Each error contains: parent, affectedField, reason, structure
}
For detailed usage, see USAGE.md.
# Clone the repository
git clone https://github.com/firstpersoncode/mockingjar-lib
cd mockingjar-lib
# Install dependencies
npm install
# Development
npm run dev # Watch mode compilation
npm run build # Production build with minification
npm run build:clean # Clean build from scratch
npm run build:no-minify # Build without minification
npm run start # Run compiled code
# Testing
npm run test # Run tests
npm run test:watch # Watch mode testing
npm run test:coverage # Test coverage report
npm run test:ci # CI-friendly test run
# Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix auto-fixable lint issues
npm run lint:check # Strict linting with zero warnings
# Type Checking
npm run compile # Type check without output
npm run compile:check # Fast type check with skip lib check
src/npm run test:watchnpm run compile:checknpm run lint:fixnpm run build:cleanmockingjar-lib/
├── src/ # Source code
│ ├── index.ts # Main entry point with module exports
│ ├── lib/ # Core business logic
│ └── types/ # TypeScript type definitions
├── __tests__/ # Comprehensive test suite
├── dist/ # Compiled JavaScript output
├── coverage/ # Test coverage reports
├── scripts/ # Build and utility scripts
└── README.md # Project documentation
/src/lib/ - Core Business LogicThe heart of the library containing all essential functionality:
/src/types/ - TypeScript DefinitionsComplete type system for the library:
/__tests__/ - Comprehensive Test Suite146 unit tests covering all critical functionality:
The library provides comprehensive tools for creating and managing JSON schemas through the Schema module:
Support for all essential data types with full constraint configuration:
interface SchemaField {
id: string;
name: string;
type: 'text' | 'number' | 'boolean' | 'date' | 'email' | 'url' | 'array' | 'object' | 'schema';
logic?: {
required?: boolean;
minLength?: number;
maxLength?: number;
min?: number;
max?: number;
pattern?: string;
enum?: string[];
minItems?: number;
maxItems?: number;
};
children?: SchemaField[]; // For object type
arrayItemType?: SchemaField; // For array type
description?: string;
}
Advanced data generation with AI integration and error recovery through the Generator module:
Comprehensive JSON validation engine through the Validation module:
interface ValidationError {
parent: string | null;
affectedField: string;
reason: string;
structure: SchemaField | null;
}
Advanced error handling with surgical regeneration:
The project includes a comprehensive test suite covering all critical functionality with 146 tests and 88% code coverage:
__tests__/
├── generator.test.js # Data generation tests
├── schema.test.js # Schema manipulation tests
├── validation.test.js # Schema validation and error handling tests
├── json-to-schema-conversion.test.js # JSON conversion tests
├── deep-nested-deletion.test.js # Deep structure tests
└── deep-array-item-deletion.test.js # Array manipulation tests
# Run all tests
npm test
# Watch mode for development
npm run test:watch
# Generate coverage report
npm run test:coverage
# CI-friendly test run
npm run test:ci
MockingJar Library thrives on community collaboration! We welcome contributions from developers of all experience levels.
Fork and Clone
git clone https://github.com/firstpersoncode/mockingjar-lib
cd mockingjar-lib
Install Dependencies
npm install
Set Up Environment
cp .env.example .env
# Add your Anthropic API key
Run Tests
npm run test:watch
Start Development
npm run dev
Create Feature Branch
git checkout -b feature/your-feature-name
Make Changes
Quality Checks
npm run lint:fix
npm run test:coverage
npm run compile:check
Submit PR
Ready to contribute? Open an issue, submit a pull request, or simply star the project to show your support!
Together, we're building the future of JSON data generation.
Copyright (c) 2025 MockingJar Library
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For technical support, feature requests, or bug reports, please contact the development team or create an issue in the project repository.
MockingJar Library - Powering intelligent JSON schema creation and data generation.
FAQs
A TypeScript library for AI-powered JSON mock data generation using schema-based configuration
The npm package mockingjar-lib receives a total of 6 weekly downloads. As such, mockingjar-lib popularity was classified as not popular.
We found that mockingjar-lib demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.