{"id":25973217,"url":"https://github.com/demvsystems/yup-ast","last_synced_at":"2025-03-05T01:19:46.516Z","repository":{"id":37593192,"uuid":"252520074","full_name":"demvsystems/yup-ast","owner":"demvsystems","description":"Rewrite of the original yup-ast due to licensing problems (with consent of the original author).","archived":false,"fork":false,"pushed_at":"2023-02-03T05:36:13.000Z","size":1294,"stargazers_count":18,"open_issues_count":5,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-02T08:18:09.785Z","etag":null,"topics":["json","schema","typescript","validation","yup"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/demvsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-02T17:18:14.000Z","updated_at":"2023-01-20T13:54:36.000Z","dependencies_parsed_at":"2023-02-18T03:46:17.356Z","dependency_job_id":null,"html_url":"https://github.com/demvsystems/yup-ast","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demvsystems%2Fyup-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demvsystems%2Fyup-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demvsystems%2Fyup-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/demvsystems%2Fyup-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/demvsystems","download_url":"https://codeload.github.com/demvsystems/yup-ast/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241801254,"owners_count":20022390,"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","typescript","validation","yup"],"created_at":"2025-03-05T01:19:45.955Z","updated_at":"2025-03-05T01:19:46.504Z","avatar_url":"https://github.com/demvsystems.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yup-ast\n\n[![Latest Stable Version](https://img.shields.io/npm/v/@demvsystems/yup-ast.svg)](https://www.npmjs.com/package/@demvsystems/yup-ast)\n[![Node.js Package](https://github.com/demvsystems/yup-ast/workflows/Node.js%20Package/badge.svg)](https://github.com/demvsystems/yup-ast/actions)\n[![NPM Downloads](https://img.shields.io/npm/dm/@demvsystems/yup-ast.svg)](https://www.npmjs.com/package/@demvsystems/yup-ast)\n[![dependencies Status](https://david-dm.org/demvsystems/yup-ast/status.svg)](https://david-dm.org/demvsystems/yup-ast)\n[![Test Coverage](https://img.shields.io/codecov/c/github/demvsystems/yup-ast/master.svg)](https://codecov.io/github/demvsystems/yup-ast?branch=master)\n\n\u003e Generates [yup](https://github.com/jquense/yup) instances from JSON schemas.\n\nThis project is meant to be a successor to the original [yup-ast](https://github.com/WASD-Team/yup-ast)\nwhich - due to licensing issues - can no longer be actively maintained.\nDue to time contraints, only the core functionality has been ported so far.\nFeel free to add any potential improvements or missing APIs from the original via PRs!\n\n## Installation\n    npm install --save @demvsystems/yup-ast\n\n## Usage\n\n### ES5\n    var transformAll = require('@demvsystems/yup-ast').transformAll;\n\n### ES2015+\n    import { transformAll } from '@demvsystems/yup-ast';\n\n### Transforming JSON to a schema instance\nThe JSON representation of a yup schema is an array with each call being an array again.\nThe method calls start with \"yup.\". Each parameter is an additional array entry afterwards.\n\nExample: To create a schema like the following:\n```ts\nconst schema = yup.array()\n  .required()\n  .min(2)\n  .of(\n    yup.object()\n      .required()\n      .shape({\n        foo: yup.string().required(),\n      })\n  );\n```\n\nyou call `transformAll` like this:\n```ts\nconst schema = transformAll([\n  ['yup.array'],\n  ['yup.required'],\n  ['yup.min', 2],\n  ['yup.of', [\n    ['yup.object'],\n    ['yup.required'],\n    ['yup.shape', {\n      foo: [['yup.string'], ['yup.required']],\n    }],\n  ]],\n]);\n```\n\nBoth can be validated the same way:\n```ts\nschema.isValidSync([\n  { foo: 'bar' },\n  { foo: 'baz' },\n]); // =\u003e true\n```\n\nFor more example use cases, have a look at [the included test cases](./src/__tests__/test.test.ts).\n\n## Changelog\nPlease look at [the releases](https://github.com/demvsystems/yup-ast/releases) for more information on what has changed recently.\n\n## Credits\n- [spaceemotion](https://github.com/spaceemotion)\n- [All Contributors](https://github.com/demvsystems/yup-ast/contributors)\n\n## License\nThe ISC License (ISC). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemvsystems%2Fyup-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdemvsystems%2Fyup-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdemvsystems%2Fyup-ast/lists"}