{"id":50705230,"url":"https://github.com/srinitude/effect-json-schema","last_synced_at":"2026-06-09T11:01:14.256Z","repository":{"id":361039051,"uuid":"1252836153","full_name":"srinitude/effect-json-schema","owner":"srinitude","description":"Tiny Effect Schema adapter for Standard JSON Schema V1","archived":false,"fork":false,"pushed_at":"2026-05-29T00:36:06.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-29T01:20:54.034Z","etag":null,"topics":["effect","json-schema","openapi","standard-schema","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/srinitude/effect-json-schema#readme","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srinitude.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-28T23:22:45.000Z","updated_at":"2026-05-29T00:36:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/srinitude/effect-json-schema","commit_stats":null,"previous_names":["srinitude/effect-json-schema"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/srinitude/effect-json-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinitude%2Feffect-json-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinitude%2Feffect-json-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinitude%2Feffect-json-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinitude%2Feffect-json-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srinitude","download_url":"https://codeload.github.com/srinitude/effect-json-schema/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srinitude%2Feffect-json-schema/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34103357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["effect","json-schema","openapi","standard-schema","typescript"],"created_at":"2026-06-09T11:01:13.483Z","updated_at":"2026-06-09T11:01:14.243Z","avatar_url":"https://github.com/srinitude.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# effect-json-schema\n\nTiny Effect Schema adapter for [Standard JSON Schema V1](https://standardschema.dev/json-schema).\n\n`effect-json-schema` keeps the runtime surface deliberately small: pass an Effect `Schema`, receive a Standard JSON Schema object with `~standard.version`, `~standard.vendor`, `~standard.types`, and `~standard.jsonSchema.input/output`.\n\n## Install\n\n```sh\nnpm install effect-json-schema effect @standard-schema/spec\n```\n\n## Usage\n\n```ts\nimport * as S from \"effect/Schema\"\nimport { toStandardJsonSchema, type InferInput, type InferOutput } from \"effect-json-schema\"\n\nconst Person = S.Struct({ name: S.String })\nconst standard = toStandardJsonSchema(Person)\n\nconst jsonSchema = standard[\"~standard\"].jsonSchema.input({\n  target: \"draft-2020-12\"\n})\n\ntype PersonInput = InferInput\u003ctypeof standard\u003e\ntype PersonOutput = InferOutput\u003ctypeof standard\u003e\n```\n\n## Supported targets\n\nThe adapter supports every Standard JSON Schema V1 target required by the protocol:\n\n- `draft-2020-12`\n- `draft-07`\n- `openapi-3.0`\n\nUnknown target strings throw `TypeError` so future targets cannot silently produce incorrect schemas.\n\n## Input and output schemas\n\nEffect transforms can have different encoded input and decoded output types. The adapter preserves that distinction by using `Schema.encodedSchema` for `jsonSchema.input()` and `Schema.typeSchema` for `jsonSchema.output()`.\n\n```ts\nconst TextToNumber = S.transform(S.String, S.Number, {\n  strict: true,\n  decode: (value) =\u003e Number(value),\n  encode: (value) =\u003e String(value)\n})\n\nconst standard = toStandardJsonSchema(TextToNumber)\nstandard[\"~standard\"].jsonSchema.input({ target: \"draft-07\" })  // { type: \"string\" }\nstandard[\"~standard\"].jsonSchema.output({ target: \"draft-07\" }) // { type: \"number\" }\n```\n\n## `libraryOptions`\n\n`libraryOptions` are forwarded to Effect's JSON Schema generator. For example, this enables Effect's `additionalPropertiesStrategy` option:\n\n```ts\nstandard[\"~standard\"].jsonSchema.input({\n  target: \"draft-07\",\n  libraryOptions: { additionalPropertiesStrategy: \"allow\" }\n})\n```\n\n## Quality gates\n\nThis repository is intentionally small, but CI is not minimal. Every push and pull request runs:\n\n- TypeScript strict type-checking\n- Build and declaration emit\n- Vitest contract tests for the Standard JSON Schema protocol\n- LOC, construct length, nesting, and marker-text gates\n- Repository health checks for license, docs, templates, and workflows\n- `npm pack` consumer smoke tests for runtime and type imports\n- `publint` package checks\n\nRun the full gate locally:\n\n```sh\nnpm run ci\n```\n\n## License\n\nApache-2.0. See [LICENSE](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrinitude%2Feffect-json-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrinitude%2Feffect-json-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrinitude%2Feffect-json-schema/lists"}