{"id":20204990,"url":"https://github.com/sinha-sahil/type-crafter","last_synced_at":"2025-04-10T12:13:07.480Z","repository":{"id":199961436,"uuid":"703222212","full_name":"sinha-sahil/type-crafter","owner":"sinha-sahil","description":"A tool to generate types from a yaml schema for any language","archived":false,"fork":false,"pushed_at":"2025-02-26T14:55:08.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"release","last_synced_at":"2025-03-24T11:07:18.876Z","etag":null,"topics":["generate","generator","javascript","types","typescript","yaml"],"latest_commit_sha":null,"homepage":"","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/sinha-sahil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-10T20:36:48.000Z","updated_at":"2025-01-07T13:35:23.000Z","dependencies_parsed_at":"2023-10-14T19:44:42.326Z","dependency_job_id":"4a13a23c-6369-4cf0-9881-5158ea9a2a1e","html_url":"https://github.com/sinha-sahil/type-crafter","commit_stats":null,"previous_names":["sinha-sahil/type-crafter"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinha-sahil%2Ftype-crafter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinha-sahil%2Ftype-crafter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinha-sahil%2Ftype-crafter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinha-sahil%2Ftype-crafter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinha-sahil","download_url":"https://codeload.github.com/sinha-sahil/type-crafter/tar.gz/refs/heads/release","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773743,"owners_count":20993633,"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":["generate","generator","javascript","types","typescript","yaml"],"created_at":"2024-11-14T05:16:06.607Z","updated_at":"2025-04-10T12:13:07.460Z","avatar_url":"https://github.com/sinha-sahil.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Type Crafter\n\nTypeCrafter is a CLI tool for generating types from a YAML types specification for any language.\nThe tool is heavily inspired by [OpenAPI Generator](https://openapi-generator.tech/) and\naims to provide similar functionality for generating types with a simple YAML specification \u0026 more flexibility.\n\n## Installation\n\n```bash\nnpm i -g type-crafter\n```\n\n## Usage\n\n```bash\ntype-crafter generate \u003clanguage\u003e \u003ctypes-specification-file\u003e \u003coutput-directory\u003e\n```\n\n### Example\n\n```bash\ntype-crafter generate typescript types.yaml ./types\n```\n\nExample input specification file can be found [here](https://github.com/sinha-sahil/type-crafter/blob/release/examples/input.yaml#L1)\n\n## Input Specification\n\nThe input specification is a YAML file that contains the types specification.\nRefer the following sample specification for the structure:\n\n```yaml\ninfo:\n  version: 0.0.0\n  title: Title of your specification\ntypes:\n  SampleType:\n    type: object\n    properties:\n      name:\n        type: string\ngroupedTypes:\n  SampleGroupedType:\n    type: object\n    properties:\n      name:\n        type: string\n```\n\nThe input specification yaml file must be of following syntax:\n\n- `info` - The information about the specification. Specifying the version and title of your spec. **This is required.**\n- `types` - These are types that will be generated in flat structure.\n- `groupedTypes` - These are types that will be generated and grouped in a folder.\n\n**Note: Passing types or groupedTypes is up to your expected results. A valid spec file can contain either types or groupedTypes or both.**\n\nThe syntax for writing different types can be referred from the [OpenAPI Data Types Guide](https://swagger.io/docs/specification/data-models/data-types/).\n\n## Supported languages\n\n- [✔️] TypeScript\n- More languages will be added soon.\n\n## Contributing \u0026 Extending\n\n### Adding support for a new language\n\nTypeCrafter uses Handlebars to template syntax for different languages.\n\nTo add support for a new language, you need to create a new folder in `src/templates` directory.\nThe folder name will be the name of the language.\nThe folder must implement following files:\n\n- `index.ts` - The main file that will be exporting the [generator config](https://github.com/sinha-sahil/type-crafter/blob/release/src/types/index.ts#L5).\n- `object-syntax.hbs` - This Handlebars template file that will be used to generate the object syntax.\n- `type-file-syntax.hbs` - This Handlebars template file that will be used to generate the syntax for file which contains the generated types \u0026 its imports.\n- `exporter-module-syntax.hbs` - This Handlebars template file that will be used to generate the syntax for the module that exports the generated types.\n\n## Development\n\nTo start developing type-crafter, you need to run following commands:\n\n```bash\npnpm i\npnpm run dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinha-sahil%2Ftype-crafter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinha-sahil%2Ftype-crafter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinha-sahil%2Ftype-crafter/lists"}