{"id":15013010,"url":"https://github.com/apipost-team/apipost-mock-schema","last_synced_at":"2025-04-12T04:12:47.833Z","repository":{"id":44449110,"uuid":"512603682","full_name":"Apipost-Team/apipost-mock-schema","owner":"Apipost-Team","description":"Simple utility to mock example objects based on JSON schema definitions","archived":false,"fork":false,"pushed_at":"2024-04-24T06:09:36.000Z","size":80,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T04:51:07.620Z","etag":null,"topics":["json-schema","jsonschema","mock-data","mock-json-schema","mockjs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/apipost-mock-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/Apipost-Team.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2022-07-11T03:28:42.000Z","updated_at":"2024-07-08T12:46:57.127Z","dependencies_parsed_at":"2024-07-08T12:46:52.896Z","dependency_job_id":"f50df0a7-c727-4ea3-a33f-7548f2de24c5","html_url":"https://github.com/Apipost-Team/apipost-mock-schema","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apipost-Team%2Fapipost-mock-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apipost-Team%2Fapipost-mock-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apipost-Team%2Fapipost-mock-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apipost-Team%2Fapipost-mock-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apipost-Team","download_url":"https://codeload.github.com/Apipost-Team/apipost-mock-schema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219849222,"owners_count":16556325,"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":["json-schema","jsonschema","mock-data","mock-json-schema","mockjs"],"created_at":"2024-09-24T19:43:35.549Z","updated_at":"2024-10-14T03:22:52.400Z","avatar_url":"https://github.com/Apipost-Team.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://adesign.apipost.cn/\" target=\"_blank\"\u003e\n    \u003cimg alt=\"A-Design Logo\" width=\"360\" src=\"https://img.cdn.apipost.cn/cdn/opensource/apipost-opensource.svg\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# 🚀 apipost-mock-schema\n\n[![Package Quality](https://packagequality.com/shield/apipost-mock-schema.svg)](https://packagequality.com/#?package=apipost-mock-schema)\n\nSimple utility to mock example objects based on JSON schema definitions\n\n## Features\n\nMinimal \u0026 deterministic. Predictable single example with no randomisation involved\n\nTypeScript types included\n\nSupports $ref pointers\n\nThoroughly tested feature set\n\nSupports example, default\n\nSupports anyOf, allOf, oneOf\n\nBuilt-in examples for following string formats:\n\n - email \n - hostname \n - ipv4 \n - ipv6 \n - uri \n - uri-reference \n - uri-template \n - json-pointer\n - date-time \n - uuid\n\n\n## Install\n\n```\n$ npm install apipost-mock-schema\n```\n\n##  Usage\n```javascript\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};\nconst MockSchema = require('apipost-mock-schema');\nconst myMockSchema = new MockSchema();\n\nmyMockSchema.mock(schema).then(res =\u003e {\n    console.log(res)\n    \n    // will return\n    /*\n    [\n        {\n            \"id\": 7156472017141059,\n            \"name\": \"John Doe\",\n            \"email\": \"y.hbm@tsqxod.dm\"\n        }\n    ]\n    */\n}).catch(err =\u003e {\n    console.log(err)\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapipost-team%2Fapipost-mock-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapipost-team%2Fapipost-mock-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapipost-team%2Fapipost-mock-schema/lists"}