{"id":19223802,"url":"https://github.com/wmfs/json-schema-to-cardscript","last_synced_at":"2025-04-20T23:31:48.773Z","repository":{"id":34042314,"uuid":"166372632","full_name":"wmfs/json-schema-to-cardscript","owner":"wmfs","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-16T00:39:04.000Z","size":205,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-19T20:25:36.783Z","etag":null,"topics":["cardscript","tymly"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/wmfs.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":"2019-01-18T08:40:53.000Z","updated_at":"2025-02-28T10:05:12.000Z","dependencies_parsed_at":"2024-04-10T05:33:55.058Z","dependency_job_id":"81356209-e7a5-4542-bcca-1d40aeae7e99","html_url":"https://github.com/wmfs/json-schema-to-cardscript","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmfs%2Fjson-schema-to-cardscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmfs%2Fjson-schema-to-cardscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmfs%2Fjson-schema-to-cardscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wmfs%2Fjson-schema-to-cardscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wmfs","download_url":"https://codeload.github.com/wmfs/json-schema-to-cardscript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249977433,"owners_count":21354859,"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":["cardscript","tymly"],"created_at":"2024-11-09T15:09:34.505Z","updated_at":"2025-04-20T23:31:48.524Z","avatar_url":"https://github.com/wmfs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-schema-to-cardscript\n\n[![Tymly Cardscript](https://img.shields.io/badge/tymly-cardscript-blue.svg)](https://tymly.io/)\n[![CircleCI](https://circleci.com/gh/wmfs/json-schema-to-cardscript.svg?style=svg)](https://circleci.com/gh/wmfs/json-schema-to-cardscript)\n[![npm (scoped)](https://img.shields.io/npm/v/@wmfs/json-schema-to-cardscript.svg)](https://www.npmjs.com/package/@wmfs/json-schema-to-cardscript) \n[![codecov](https://codecov.io/gh/wmfs/json-schema-to-cardscript/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/json-schema-to-cardscript) \n[![CodeFactor](https://www.codefactor.io/repository/github/wmfs/json-schema-to-cardscript/badge)](https://www.codefactor.io/repository/github/wmfs/json-schema-to-cardscript) \n[![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/) \n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) \n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) \n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly/blob/master/packages/concrete-paths/LICENSE)\n\n\n\u003e Scaffold Cardscript from a JSON-Schema schema\n\n## \u003ca name=\"install\"\u003e\u003c/a\u003eInstall\n```bash\n$ npm install json-schema-to-cardscript --save\n```\n\n## \u003ca name=\"usage\"\u003e\u003c/a\u003eUsage\n\n```javascript\nconst jsonSchemaToCardscript = require('json-schema-to-cardscript')\n\n// Given this sort of JSON Schema...\nconst cardscript = jsonSchemaToCardscript(\n{\n  \"$schema\": \"http://json-schema.org/draft-06/schema#\",\n  \"title\": \"Pizza\",\n  \"description\": \"A model for storing details of a pizza (recipe, price etc.)\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"code\": {\n      \"title\": \"Unique code of the pizza\",\n      \"examples\": [\n        \"CHEESE_TOMATO\"\n      ],\n      \"type\": \"string\",\n      \"minLength\": 3,\n      \"maxLength\": 15\n    },\n    \"label\": {\n      \"title\": \"Customer-facing label\",\n      \"examples\": [\n        \"Cheese \u0026 Tomato\"\n      ],\n      \"type\": \"string\"\n    },\n    \"popularitySeq\": {\n      \"title\": \"Integer value to order lists by\",\n      \"type\": \"integer\",\n      \"minimum\": 1\n    },\n    \"imageUri\": {\n      \"title\": \"URI to an enticing photo of the pizza\",\n      \"examples\": [\n        \"https://tinyurl.com/y8r5bbu5\"\n      ],\n      \"type\": \"string\",\n      \"format\": \"uri\"\n    },\n    \"vegetarian\": {\n      \"title\": \"Is the pizza suitable for vegetarians?\",\n      \"default\": false,\n      \"type\": \"boolean\"\n    },\n    \"allergens\": {\n      \"title\": \"List of allergens present in pizza\",\n      \"examples\": [\n        [\n          \"Gluten\",\n          \"Wheat\",\n          \"Milk\"\n        ]\n      ],\n      \"type\": \"array\",\n      \"uniqueItems\": true,\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"availabilityEnd\": {\n      \"title\": \"Date when pizza is no longer available.\",\n      \"examples\": [\n        \"2019-12-31\"\n      ],\n      \"type\": \"string\",\n      \"format\": \"date-time\"\n    },\n    \"reviews\": {\n      \"title\": \"Favourable customer reviews\",\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"username\": {\n            \"title\": \"Who wrote the review\",\n            \"examples\": [\n              \"joebloggs4\"\n            ],\n            \"type\": \"string\"\n          },\n          \"review\": {\n            \"title\": \"Something nice to say\",\n            \"examples\": [\n              \"Lovely stuff!\"\n            ],\n            \"type\": \"string\"\n          },\n          \"rating\": {\n            \"title\": \"Star rating (0=Awful 5=Great)\",\n            \"default\": 5,\n            \"examples\": [\n              5\n            ],\n            \"type\": \"integer\",\n            \"minimum\": 0,\n            \"maximum\": 5\n          }\n        },\n        \"required\": [\n          \"username\",\n          \"review\",\n          \"rating\"\n        ]\n      }\n    }\n  },\n  \"required\": [\n    \"code\",\n    \"label\",\n    \"popularitySeq\",\n    \"imageUri\",\n    \"vegetarian\"\n  ]\n},\n// And some options\n{\n  purpose: 'editing'\n}\n)\n\n// -----------------------------------------------\n// Expect a half-decent stab at some Cardscript...\n// -----------------------------------------------\n\n\n```\n\n## \u003ca name=\"test\"\u003e\u003c/a\u003eTesting\n\n```bash\n$ npm test\n```\n\n## \u003ca name=\"license\"\u003e\u003c/a\u003eLicense\n[MIT](https://github.com/wmfs/cardscript/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmfs%2Fjson-schema-to-cardscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwmfs%2Fjson-schema-to-cardscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwmfs%2Fjson-schema-to-cardscript/lists"}