{"library":"mock-json-schema","title":"Mock JSON Schema","description":"\"mock-json-schema\" is a JavaScript utility designed to generate deterministic example objects based on JSON Schema definitions. It offers a predictable, non-randomized approach to data generation, making it suitable for testing, documentation, and mock API development. The current stable version is 1.1.2. The library supports various JSON Schema keywords, including `example`, `default`, `anyOf`, `allOf`, and `oneOf`, and provides built-in examples for common string formats like `email`, `uuid`, and `date-time`. It differentiates itself by its minimal API, deterministic output, and comprehensive test coverage. While it includes TypeScript types, a current limitation is its lack of support for `$ref` pointers, which can affect its utility for highly interconnected schemas. Release cadence appears to follow semantic versioning, with minor updates for new features and bug fixes, typically for patches and minor feature enhancements.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install mock-json-schema"],"cli":null},"imports":["import { mock } from 'mock-json-schema';","const { mock } = require('mock-json-schema');","import type { JSONSchema } from 'mock-json-schema';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { mock } from 'mock-json-schema';\n\nconst productSchema = {\n  type: 'object',\n  properties: {\n    id: { type: 'string', format: 'uuid', example: 'a1b2c3d4-e5f6-7890-1234-567890abcdef' },\n    name: { type: 'string', default: 'Example Product' },\n    price: { type: 'number', minimum: 0, default: 99.99 },\n    tags: {\n      type: 'array',\n      items: { type: 'string' },\n      default: ['electronics', 'gadget']\n    },\n    releaseDate: { type: 'string', format: 'date-time' },\n    isAvailable: { type: 'boolean', default: true }\n  },\n  required: ['id', 'name', 'price']\n};\n\nconst exampleProduct = mock(productSchema);\n\nconsole.log(exampleProduct);\n/*\nExpected output (or similar deterministic structure):\n{\n  id: 'a1b2c3d4-e5f6-7890-1234-567890abcdef',\n  name: 'Example Product',\n  price: 99.99,\n  tags: [ 'electronics', 'gadget' ],\n  releaseDate: '1970-01-01T00:00:00.000Z', // Default for date-time if no example provided\n  isAvailable: true\n}\n*/","lang":"typescript","description":"Demonstrates how to generate a mock object for a complex product schema, leveraging `example`, `default`, and built-in format types for deterministic output.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}