{"id":19985892,"url":"https://github.com/aeberdinelli/schemy-ts","last_synced_at":"2025-05-04T07:30:53.844Z","repository":{"id":144109438,"uuid":"373461536","full_name":"aeberdinelli/schemy-ts","owner":"aeberdinelli","description":"A Schemy version with TypeScript support, it's a separated project to keep some backwards compatibility issues away.","archived":false,"fork":false,"pushed_at":"2024-02-13T22:27:03.000Z","size":73,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-18T06:15:48.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/schemy-ts","language":"TypeScript","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/aeberdinelli.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,"governance":null}},"created_at":"2021-06-03T10:01:58.000Z","updated_at":"2023-12-30T11:50:16.000Z","dependencies_parsed_at":"2023-04-22T14:34:05.027Z","dependency_job_id":null,"html_url":"https://github.com/aeberdinelli/schemy-ts","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeberdinelli%2Fschemy-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeberdinelli%2Fschemy-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeberdinelli%2Fschemy-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeberdinelli%2Fschemy-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aeberdinelli","download_url":"https://codeload.github.com/aeberdinelli/schemy-ts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224028291,"owners_count":17243693,"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":[],"created_at":"2024-11-13T04:26:43.929Z","updated_at":"2024-11-13T04:26:44.425Z","avatar_url":"https://github.com/aeberdinelli.png","language":"TypeScript","funding_links":["https://www.paypal.com/donate/?cmd=_donations\u0026business=aeberdinelli%40gmail.com\u0026item_name=Schemy+library\u0026currency_code=USD\u0026source=url"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n    \u003ca href=\"https://schemy.js.org/\"\u003e\r\n        \u003cimg src=\"https://user-images.githubusercontent.com/1413883/134991554-4ff6464e-c297-4367-8191-088f9919a5e1.png\" height=\"110\"\u003e\r\n    \u003c/a\u003e\r\n\u003c/div\u003e\r\n\r\n### [Docs 📖](https://github.com/aeberdinelli/schemy/wiki) · [Plugins 🧩](https://github.com/aeberdinelli/schemy/wiki/List-of-plugins) · [Changelog 📝](https://github.com/aeberdinelli/schemy/releases) · [Donate 💰](https://www.paypal.com/donate/?cmd=_donations\u0026business=aeberdinelli%40gmail.com\u0026item_name=Schemy+library\u0026currency_code=USD\u0026source=url)\r\n\r\nSchemy is an extremely simple, lightweight yet powerful schema validation library. Perfect for lightweight-oriented projects like cloud functions where size and speed are key features. **It weights less than 18 KB!**\r\n\r\n- This is the TypeScript version of [Schemy](https://github.com/aeberdinelli/schemy). \r\n\r\n## Missing features\r\nAll features are shared with the main version, except for the short-style declaration:\r\n\r\n```typescript\r\n// This is not available :(\r\nconst schema = new Schemy({\r\n    name: String\r\n});\r\n\r\n// You need to declare it like this\r\nconst schema = new Schemy({\r\n    name: { type: String }\r\n});\r\n```\r\n\r\n## Unique features\r\nAvailable only in the TS version\r\n\r\n```typescript\r\n// Schemy needs to be imported this way\r\nimport { Schemy } from 'schemy-ts';\r\n\r\n// For the following examples we are using the following type\r\ntype User = {\r\n    name: string;\r\n    age: number;\r\n};\r\n```\r\n\r\n#### Create typed schema\r\nUse this to make sure you declare all the properties in the schema for your Type:\r\n\r\n```typescript\r\n// This will give an error because `age` is defined in the type but not in the schema\r\nconst UserSchema = Schemy.schema\u003cUser\u003e({\r\n    name: { type: String }\r\n});\r\n```\r\n\r\n#### Create strict typed schema\r\nThis is just the same as the typed schema but the resulting Schemy instance will be `strict`.\r\n\r\n```typescript\r\n// You can also do this to make the schema strict\r\nconst UserSchema = Schemy.strict\u003cUser\u003e({\r\n    name: { type: String }\r\n});\r\n```\r\n\r\n#### Validate and return typed body\r\nYou can validate and return the body with the specified type. This works extremely well with [VS Code](https://code.visualstudiSco.com/) intellisense.\r\n\r\n```typescript\r\nconst user: User = await Schemy.validate\u003cUser\u003e({ name: 'schemy' });\r\n```\r\n\r\n#### Return typed body \r\nThis is similar to the previous example, but in this case you are not validating. You're just returning the last validated input.\r\n\r\n```typescript\r\nconst user: User = Schemy.getBody\u003cUser\u003e();\r\n```\r\n\r\n## And more...\r\nTo see all the features, please visit the [Schemy wiki](https://github.com/aeberdinelli/schemy/wiki).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeberdinelli%2Fschemy-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faeberdinelli%2Fschemy-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeberdinelli%2Fschemy-ts/lists"}