{"id":19218621,"url":"https://github.com/shepherdwind/schema-util-backup","last_synced_at":"2025-10-11T03:52:53.378Z","repository":{"id":32646249,"uuid":"36233183","full_name":"shepherdwind/schema-util-backup","owner":"shepherdwind","description":"Better for human write schema define","archived":false,"fork":false,"pushed_at":"2015-08-24T07:43:10.000Z","size":184,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T15:25:51.896Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shepherdwind.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-25T13:36:53.000Z","updated_at":"2018-07-05T10:24:47.000Z","dependencies_parsed_at":"2022-07-12T15:40:35.045Z","dependency_job_id":null,"html_url":"https://github.com/shepherdwind/schema-util-backup","commit_stats":null,"previous_names":["shepherdwind/papilio-schema"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shepherdwind/schema-util-backup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fschema-util-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fschema-util-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fschema-util-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fschema-util-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shepherdwind","download_url":"https://codeload.github.com/shepherdwind/schema-util-backup/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fschema-util-backup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006106,"owners_count":26084026,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-09T14:27:28.516Z","updated_at":"2025-10-11T03:52:53.327Z","avatar_url":"https://github.com/shepherdwind.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## schema util\n\n[![Build Status](https://travis-ci.org/shepherdwind/schema-util.svg?branch=master)](https://travis-ci.org/shepherdwind/schema-util)\n\n[![NPM](https://nodei.co/npm/schema-util.png?compact=true)](https://nodei.co/npm/schema-util/)\n\n### schema dsl parse\n\n```js\nvar schema = require('schema-util').schema;\n\nvar json = schema(`\n  Array(foo) {\n    href(href),\n    title(title),\n    img(image url): Image,\n    amount(money amout)\n  }\n`);\n// json should be so:\n/**\n  {\n    type: 'array',\n    description: 'foo',\n    properties: {\n      href: { description: 'href', type: 'string' },\n      title: { description: 'title', type: 'string' },\n      img: { description: 'image url', type: 'image' },\n      amount: { description: 'money amount', type: 'string' }\n    }\n  }\n*/\n```\n\nAnd nest rule supported:\n\n```\nvar json = schema(`\n  Object(abc) {\n    title(title),\n    user(user): Object {\n      name(user name),\n      age(user age): Number\n    }\n  }\n`, ['number']);\n```\n\nThe secend argument, you can add some more type support, such as\n`age.number`, `background.color`.\n\n```\nschema(`Array(foo) { a(a)}`, types)\n```\n\nThe defaultType is 'string', If you want change this, you need send\nthe secend argument like this:\n\n```\nschema(`Array(foo) { a(a)}`, {\n  defaultType: 'number',\n  supported: ['string']\n});\n```\n\n#### export support\n\nWrite code like this example, you can get a object, which have to\nproperties a and b. Each property have the value of schema object.\n\n```\nschema(`\n  export a Object(hello) { ... }\n\n  export b Array(hello b) { ... }\n`);\n```\n\n### mock\n\nmock schema data\n\n```\nmock(schema, config)\n```\n\nconfig can set default type value, for example, config set to { image: 'xx.png' },\nthen schema mock image type value will be xx.png.\n\nconfig value can be an function.\n\n### walk\n\nwalk every property of schema.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepherdwind%2Fschema-util-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshepherdwind%2Fschema-util-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepherdwind%2Fschema-util-backup/lists"}