{"id":40362615,"url":"https://github.com/twogate/typedgate","last_synced_at":"2026-01-20T10:31:46.070Z","repository":{"id":35154955,"uuid":"213979487","full_name":"twogate/typedgate","owner":"twogate","description":"A Schema-less JSON validator, only requires typescript interface definitions","archived":false,"fork":false,"pushed_at":"2022-12-30T18:50:09.000Z","size":713,"stargazers_count":2,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T12:03:15.621Z","etag":null,"topics":["json","typechecker","typescript","validation","validator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/typedgate","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/twogate.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}},"created_at":"2019-10-09T17:19:59.000Z","updated_at":"2020-04-28T07:36:04.000Z","dependencies_parsed_at":"2023-01-15T14:56:27.574Z","dependency_job_id":null,"html_url":"https://github.com/twogate/typedgate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/twogate/typedgate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogate%2Ftypedgate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogate%2Ftypedgate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogate%2Ftypedgate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogate%2Ftypedgate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twogate","download_url":"https://codeload.github.com/twogate/typedgate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twogate%2Ftypedgate/sbom","scorecard":{"id":904241,"data":{"date":"2025-08-18","repo":{"name":"github.com/twogate/typedgate","commit":"3bfaba396cdef78b8513c443cc8997e62ad84b5f"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":2.4,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/twogate/typedgate/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/twogate/typedgate/nodejs.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"31 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T16:46:03.914Z","repository_id":35154955,"created_at":"2025-08-24T16:46:03.914Z","updated_at":"2025-08-24T16:46:03.914Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28601819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T09:39:28.479Z","status":"ssl_error","status_checked_at":"2026-01-20T09:38:10.511Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","typechecker","typescript","validation","validator"],"created_at":"2026-01-20T10:31:46.012Z","updated_at":"2026-01-20T10:31:46.065Z","avatar_url":"https://github.com/twogate.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"TypedGate - a JSON Type Checker \u0026 Validator without schemas\n===========================================================\nTypedGate is a JSON checker \u0026 validator tool without using any schemas but **only requires typescript interface definitions and simple comments**.\n\nTypedGate compares typescript interface/class definition to JSON then output validation results.\n\n![TypedGate Screenshot](docs/typedgate-screenshot.png)\n\n## Installation\n### Try now without installation (npx)\nYou can use npx to use TypedGate without installation:\n\n```bash\nnpx typedgate --tsconfig ./tsconfig.json --src ./src/index.ts --json ./some-json-file.json\n```\n\n### Global installation\n```bash\nnpm install -g typedgate\n```\n\n```bash\ntypedgate --tsconfig ./tsconfig.json --src ./src/index.ts --json ./some-json-file.json\n```\n\n## Checking your TypeScript codes of Interfaces / Classes with TypedGate\n### Add ControlComment to your Interface/Class definitions\n\nIn this example, control-comment `@TG:path .engine` is added to `Engine` interface.\nTypedGate recognize that JSON's `engine` property should follow `Engine` interface.\n\n```typescript\nexport type CylinderLayout = 'inline' | 'flat' | 'v';\nexport type FuelSystemKind = 'injection' | 'carburetor';\nexport type EngineDirection = 'longitudinal' | 'transverse';\n\n// This is a control comment\n// @TG:path .engine\nexport interface Engine {\n  name: string\n  displacement: number;\n  bore: number;\n  stroke: number;\n  compressionRatio: number;\n  turbo: boolean;\n  intercooler: boolean;\n  fuelSystem: FuelSystemKind;\n  vvt: boolean;\n  cylinderCount: number;\n  rotary: boolean;\n  diesel: boolean;\n  cylinderLayout: CylinderLayout;\n  engineDirection: EngineDirection;\n  ignitionPlugName?: string;\n}\n```\n\nNote that control-comments should be placed above the interface/class declaration.\n\nTypedGate compares `Engine` interface to following json:\n\n```json\n{\n  \"engine\": {\n    \"name\": \"1KZ\",\n    \"displacement\": 2982,\n    \"bore\": 96,\n    \"stroke\": 103,\n    \"compressionRatio\": 21.2,\n    \"turbo\": true,\n    \"intercooler\": false,\n    \"fuelSystem\": \"injection\",\n    \"vvt\": false,\n    \"cylinderCount\": 4,\n    \"rotary\": false,\n    \"diesel\": true,\n    \"cylinderLayout\": \"inline\",\n    \"engineDirection\": \"longitudinal\"\n  }\n}\n```\n\nSince this JSON has valid type of `Engine` interface, TypedGate will print following output:\n\n```\nLoading project...\nValidating...\n=== Validation Result ===\nValid\n```\n\nTypedGate also recognize multiple control-comment like this:\n\n```typescript\n// @TG:path .login.providers.twitter\n// @TG:path .login.providers.facebook\n// @TG:path .login.providers.line\nexport interface ProviderItem {\n  displayName: string;\n  isShow: boolean;\n}\n```\n\nJSON shown below satisfies above interface definition.\n\n```json\n{\n  \"login\":{\n    \"providers\":{\n      \"twitter\":{\n        \"displayName\":\"Twitter\",\n        \"isShow\":true\n      },\n      \"facebook\":{\n        \"displayName\":\"Facebook\",\n        \"isShow\":false\n      },\n      \"line\":{\n        \"displayName\":\"LINE\",\n        \"isShow\":true\n      }\n    }\n  }\n}\n```\n\n### Run TypedGate\n\nTo run TypedGate, you should specify path to project's tsconfig.json, path to source file, path to json to validate.\n\n- `-t` or `--tsconfig`: path to `tsconfig.json`\n- `-s` or `--src`: path to source file to validate\n- `-j` or `--json`: path to json file to validate\n    - Since TypedGate is not a JSON validator, JSON with wrong syntax will cause application error.\n- `-v` or `--verbose`: TypedGate will print verbose outputs\n\n```\ntypedgate --tsconfig ./test/fixtures/car-types/tsconfig.json --src ./test/fixtures/car-types/engine.ts --json ./test/fixtures/car-types/engine.json\n```\n\n(You can use `npx` without installation as described in 'Installation' section)\n\nTypedGate will exit with code 0 when validation is success. Exit code 1 will be returned when validation failure.\n\n## Hint\n### Validating multiple files\n`--src` option can be take one single file. To validate multiple files, we recommend that you put a file like this:\n\n```typescript\nexport * from './color-theme';\nexport * from './general';\nexport * from './advanced';\nexport * from './tabs';\n// other exports ...\n```\n\nWe assume this file is named `src/index.ts`. To validate these exported files, you can run this command:\n\n```\ntypedgate --tsconfig path/to/tsconfig.json --src ./src/index.ts --json /path/to/something.json\n```\n\n### Array path\nAssume a JSON of array like this:\n\n```json\n[\n  {\n    \"num\": 123,\n  },\n  {\n    \"num\": 321,\n  },\n  {\n    \"num\": 987,\n  },\n  {\n    \"num\": 456,\n  }\n]\n```\n\nAn array is represented as `[]` in TypedGate. So below interface and ControlComment can validate above JSON.\n\n```typescript\n// @TG:path .[]\nexport interface ArrayInterface {\n  num: number;\n}\n```\n\nAn array in object like this:\n\n```json\n{\n  \"array\":\n    [\n      {\n        \"num\": 123,\n      },\n      {\n        \"num\": 321,\n      }\n    ]\n}\n```\n\nis represented as:\n\n```typescript\n// @TG:path .array[]\nexport interface ArrayInterface {\n  num: number;\n}\n```\n\n## API\nYou can use TypedGate in your Node program.\n\n```sh\nnpm install typedgate\n```\n\n```typescript\nimport { TypedGate, TypedGateResult } from '../src/index'\n\nconst tg = new TypedGate('./path/to/tsconfig.json', './path/to/project/index.ts')\ntg.validateJsonFile('./test/fixtures/crayon-types/crayon-type.json').then((isValid: boolean) =\u003e {\n  if (isValid) {\n    console.log('Valid JSON \u0026 TypeScript combination')\n  } else {\n    const resultDetail: TypedGateResult[] | undefined = tg.validationResult\n    // validation fails:\n    // validationResult property contains detail of errors\n    console.log('Not valid JSON \u0026 TypeScript combination')\n    console.log(resultDetail)\n  }\n})\n\n// You can also pass object directly rather than pass file path to JSON.\nconst object = {\n  \"some object\": {\n    // ...\n  }\n}\ntg.validateObject(object).then(/*...*/)\n```\n\nBelow is an example of failed validation.\n\n`TypedGate.validationResult` property contains source file name of typescript, position where error occurs, etc.\n\n```typescript\n[\n  {\n    objectPathIdentifier: [ 'home', 'contents', 'available' ],\n    objectValue: undefined,\n    sourceFileName: '/path/to/project/test/fixtures/crayon-types/home.ts',\n    text: 'available: boolean;',\n    sourceFilePos: { line: 9, column: 25 },\n    valid: false\n  },\n  {\n    objectPathIdentifier: [ 'home', 'contents' ],\n    objectValue: [ [Object], [Object], [Object] ],\n    sourceFileName: '/path/to/project/test/fixtures/crayon-types/home.ts',\n    text: 'contents: HomeContent[];',\n    sourceFilePos: { line: 4, column: 30 },\n    valid: false\n  },\n  {\n    objectPathIdentifier: [ 'home' ],\n    objectValue: { contents: [Array] },\n    sourceFileName: '/path/to/project/test/fixtures/crayon-types/home.ts',\n    text: 'export interface HomeConfig {\\n  contents: HomeContent[];\\n}',\n    sourceFilePos: { line: 1, column: 40 },\n    valid: false\n  }\n]\n```\n\n### Methods \u0026 Properties\n- `constructor(private tsConfigFilePath: string, private sourceFilePath: string)`\n    - `tsConfigFilePath`: path to `tsconfig.json`\n    - `sourceFilePath`: path to typescript source file (e.g. project's root `index.ts`)\n- `validateJsonFile(fileName: string)`\n    - `fileName`: full path to JSON file to validate\n- `validateObject(targetData: any): boolean`\n    - `targetData`: object to validate (rather than pass file path to JSON by using `validateJsonFile()`.)\n- `get validationResult: TypedGateResult[] | undefined`\n    - `objectPathIdentifier`: indicates location of failed object\n    - `objectValue`: `objectPathIdentifier`'s value\n    - `sourceFileName`: path to TypeScript source code where validation failed\n    - `text`: TypeScript source raw text that validation failed\n    - `sourceFilePos`: position of failed TypeScript source code\n    - `valid`: whether validation success or failed\n\n## Development\n### Run TypedGate\nIn `test/` directory, you can find various useful test cases to develop the TypedGate code.\n\n```\nnpm run build \u0026\u0026 node dist/cli.js -v --tsconfig ./test/fixtures/car-types/tsconfig.json --src ./test/fixtures/car-types/engine.ts --json ./test/fixtures/car-types/engine.json\n```\n\n`-v` (`--verbose`) switch will help your development.\n\n### Run tests\n```\nnpm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwogate%2Ftypedgate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwogate%2Ftypedgate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwogate%2Ftypedgate/lists"}