{"id":15013001,"url":"https://github.com/imjuni/schema-nozzle","last_synced_at":"2025-04-12T03:31:21.963Z","repository":{"id":62003210,"uuid":"552705484","full_name":"imjuni/schema-nozzle","owner":"imjuni","description":"json-schema generate from typescript interface and type alias, class, enum","archived":false,"fork":false,"pushed_at":"2024-06-10T16:33:04.000Z","size":2802,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T23:23:35.632Z","etag":null,"topics":["cli","json","json-schema","jsonschema","schema","tools","ts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/imjuni.png","metadata":{"files":{"readme":"README.ko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-17T05:17:16.000Z","updated_at":"2024-06-10T16:32:38.000Z","dependencies_parsed_at":"2024-06-10T18:49:25.547Z","dependency_job_id":null,"html_url":"https://github.com/imjuni/schema-nozzle","commit_stats":{"total_commits":107,"total_committers":1,"mean_commits":107.0,"dds":0.0,"last_synced_commit":"464075b1814d6ac01914dab38e0f8ed61adf027a"},"previous_names":["imjuni/create-ts-json-schema"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fschema-nozzle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fschema-nozzle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fschema-nozzle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imjuni%2Fschema-nozzle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imjuni","download_url":"https://codeload.github.com/imjuni/schema-nozzle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248114418,"owners_count":21050033,"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":["cli","json","json-schema","jsonschema","schema","tools","ts","typescript"],"created_at":"2024-09-24T19:43:34.884Z","updated_at":"2025-04-12T03:31:18.348Z","avatar_url":"https://github.com/imjuni.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# schema-nozzle\n\n![ts](https://flat.badgen.net/badge/Built%20With/TypeScript/blue)\n[![Download Status](https://img.shields.io/npm/dw/schema-nozzle.svg?style=flat-square)](https://npmcharts.com/compare/schema-nozzle) [![Github Star](https://img.shields.io/github/stars/imjuni/schema-nozzle.svg?style=flat-square)](https://github.com/imjuni/schema-nozzle) [![Github Issues](https://img.shields.io/github/issues-raw/imjuni/schema-nozzle.svg?style=flat-square)](https://github.com/imjuni/schema-nozzle/issues) [![NPM version](https://img.shields.io/npm/v/schema-nozzle.svg?style=flat-square)](https://www.npmjs.com/package/schema-nozzle) [![License](https://img.shields.io/npm/l/schema-nozzle.svg?style=flat-square)](https://github.com/imjuni/schema-nozzle/blob/master/LICENSE)\n\n`schema-nozzle`은 타입스크립트 `interface`, `type alias`, `class`, `enum`에서 json-schema를 생성합니다. express.js, fastify.js를 사용해서 RESTful API 서버를 개발할 때 json-schema를 작성하고, 타입도 작성하는 경험을 해보았을 것입니다. json-schema와 타입은 코드는 다르지만 의미는 동일하여 이를 모두 작성하는 것은 같은 일을 두 번하는 것과 같습니다. 그래서 [json-schema-to-ts](https://www.npmjs.com/package/json-schema-to-ts)와 같은 도구를 사용합니다. schema-nozzle는 json-schema-to-ts의 역, 타입스크립트 타입을 json-schema로 변환하는 작업을 자동화 합니다.\n\n왜 `schema-nozzle`을 사용해야 하나요?\n\n- 타입스크립트 타입을 json-schema로 변환합니다\n- 타입스크립트 타입을 사용하기 때문에 jsdoc, typedoc와 같은 문서화 도구와 잘 어울립니다\n- fastify를 사용하면 validation을 자동화 할 수 있고, swagger 문서도 자동으로 작성합니다\n- 여러가지 json-schema 생성 방식을 지원합니다\n\n`schema-nozzle`로 json-schema를 자동으로 추출하세요!\n\n## Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [Getting Started](#getting-started)\n- [Installation](#installation)\n- [Usage](#usage)\n- [How it works?](#how-it-works)\n- [Example using fastify.js](#example-using-fastifyjs)\n- [License](#license)\n\n## Getting Started\n\n```bash\nnpx schema-nozzle init\nnpx schema-nozzle refresh\n```\n\ninit 명령어를 사용하면 `.nozzlerc` 파일과 `.nozzlefiles` 파일을 생성합니다. 이 후 refresh 명령어를 실행하면 `.nozzlefiles` 파일에 추가한 모든 `interface`, `type alias`, `class`, `enum` 파일에서 `json-schema`를 생성합니다.\n\n어떻게 동작하는지 확인해보세요!\n\n![demo](assets/ctjs_demo.gif)\n\n## Installation\n\n```bash\n# npm\nnpm install schema-nozzle --save-dev\n```\n\n```bash\n# npm\npnpm add schema-nozzle --dev\n```\n\n## Usage\n\n--help 옵션을 사용하면 언제든지 상세한 사용법을 확인할 수 있습니다.\n\n```bash\n# display help for each commands\nnpx schema-nozzle --help\n\n# display help for add commands\nnpx schema-nozzle add --help\n\n# display help for del commands\nnpx schema-nozzle del --help\n\n# display help for refresh commands\nnpx schema-nozzle refresh --help\n\n# display help for truncate commands\nnpx schema-nozzle truncate --help\n```\n\n## How it works?\n\nschema-nozzle은 TypeScript 컴파일러 API를 사용합니다. 그래서 소스코드를 분석해서 `json-schema`를 추출해야 할 대상을 정확하게 알아냅니다.\n\n```mermaid\ngraph LR\n\nINP_TI[interface] --\u003e SN[schema-nozzle]\nINP_TT[type alias] --\u003e SN[schema-nozzle]\nINP_TC[class] --\u003e SN[schema-nozzle]\nINP_TE[enum] --\u003e SN[schema-nozzle]\nSN --\u003e DB[db.json]\n```\n\n- `schema-nozzle`은 [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator)를 사용해서 json-schema를 생성합니다\n- `.nozzlefiles`은 [gitignore spec.](https://git-scm.com/docs/gitignore) 규격을 사용합니다\n\n## Example using fastify.js\n\nschema-nozzle을 사용하여 swagger.io 문서작성과 json-schema를 사용하여 입출력 값 검증을 처리하는 전체 예제를 [Ma-eum](https://github.com/imjuni/maeum)에서 볼 수 있습니다. DTO 타입 선언으로 swagger.io 문서작성, json-schema 작성, typedoc 문서작성을 한 번에 처리하는 예제를 참고해보세요!\n\n## License\n\nThis software is licensed under the [MIT](https://github.com/imjuni/schema-nozzle/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjuni%2Fschema-nozzle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimjuni%2Fschema-nozzle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimjuni%2Fschema-nozzle/lists"}