{"id":15654727,"url":"https://github.com/anttiviljami/mock-json-schema","last_synced_at":"2025-04-14T13:11:39.953Z","repository":{"id":33395601,"uuid":"158030557","full_name":"anttiviljami/mock-json-schema","owner":"anttiviljami","description":"Simple utility to mock example objects based on JSON schema definitions","archived":false,"fork":false,"pushed_at":"2023-10-17T03:41:25.000Z","size":270,"stargazers_count":26,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T02:14:19.454Z","etag":null,"topics":["hacktoberfest","json-schema","mock","openapi"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mock-json-schema","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anttiviljami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"anttiviljami","custom":["https://buymeacoff.ee/anttiviljami"]}},"created_at":"2018-11-17T22:34:25.000Z","updated_at":"2023-10-06T11:09:37.000Z","dependencies_parsed_at":"2024-06-18T16:25:42.994Z","dependency_job_id":null,"html_url":"https://github.com/anttiviljami/mock-json-schema","commit_stats":{"total_commits":30,"total_committers":6,"mean_commits":5.0,"dds":0.7,"last_synced_commit":"000efe17712077e5e66be2db3dae2592c7425570"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttiviljami%2Fmock-json-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttiviljami%2Fmock-json-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttiviljami%2Fmock-json-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anttiviljami%2Fmock-json-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anttiviljami","download_url":"https://codeload.github.com/anttiviljami/mock-json-schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886324,"owners_count":21177643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","json-schema","mock","openapi"],"created_at":"2024-10-03T12:53:41.376Z","updated_at":"2025-04-14T13:11:38.386Z","avatar_url":"https://github.com/anttiviljami.png","language":"TypeScript","funding_links":["https://github.com/sponsors/anttiviljami","https://buymeacoff.ee/anttiviljami"],"categories":[],"sub_categories":[],"readme":"# mock-json-schema\n[![CI](https://github.com/anttiviljami/mock-json-schema/workflows/CI/badge.svg)](https://github.com/anttiviljami/mock-json-schema/actions?query=workflow%3ACI)\n[![npm version](https://img.shields.io/npm/v/mock-json-schema.svg)](https://www.npmjs.com/package/mock-json-schema)\n[![npm downloads](https://img.shields.io/npm/dw/mock-json-schema)](https://www.npmjs.com/package/mock-json-schema)\n[![License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/anttiviljami/mock-json-schema/blob/master/LICENSE)\n[![Buy me a coffee](https://img.shields.io/badge/donate-buy%20me%20a%20coffee-orange)](https://buymeacoff.ee/anttiviljami)\n\nSimple utility to mock example objects based on JSON schema definitions\n\n## Features\n\n- [x] Minimal \u0026 deterministic. Predictable single example with no randomisation involved\n- [x] Thoroughly [tested](https://github.com/anttiviljami/mock-json-schema/blob/master/src/mock.test.ts) feature set\n- [x] Supports `example`, `default`\n- [x] Supports `anyOf`, `allOf`, `oneOf`\n- [x] Built-in examples for following string formats:\n\t- `email`\n\t- `hostname`\n\t- `ipv4`\n\t- `ipv6`\n\t- `uri`\n\t- `uri-reference`\n\t- `uri-template`\n\t- `json-pointer`\n\t- `date-time`\n\t- `uuid`\n- [x] TypeScript types included\n- [ ] Supports $ref pointers\n\n## Usage\n\n```javascript\nconst { mock } = require('mock-json-schema');\nconst assert = require('assert');\n\nconst schema = {\n  type: 'array',\n  items: {\n    type: 'object',\n    properties: {\n      id: {\n        type: 'integer',\n        minimum: 1,\n      },\n      name: {\n        type: 'string',\n        example: 'John Doe',\n      },\n      email: {\n        type: 'string',\n        format: 'email',\n      },\n    },\n  },\n};\n\nassert.deepEqual(mock(schema), [{ id: 1, name: 'John Doe', email: 'user@example.com' }]);\n```\n\nView more [examples](https://github.com/anttiviljami/mock-json-schema/blob/master/src/mock.test.ts)\n\n## Contributing\n\nmock-json-schema is Free and Open Source Software. Issues and pull requests are more than welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanttiviljami%2Fmock-json-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanttiviljami%2Fmock-json-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanttiviljami%2Fmock-json-schema/lists"}