Effect 3: add `~standard.jsonSchema` to `Schema.standardSchemaV1`
メンテナーはふだん 1 日以内に返信
@effect-bot がすでに取り組んでいます。
2026年10月22日 から。
評価
この issue はまだ評価されていません。
説明
What is the problem this feature would solve?
Effect 4 implements Standard JSON Schema through Schema.toStandardJSONSchemaV1. On Effect 3 ([email protected]), Schema.standardSchemaV1 only implements Standard Schema validation:
import { Schema } from "effect"
const Note = Schema.Struct({ title: Schema.String, pinnedAt: Schema.NumberFromString })
const standard = Schema.standardSchemaV1(Note)["~standard"]
console.log(Object.keys(standard).join(", "))
console.log(standard.jsonSchema)
version, vendor, validate
undefined
Tools that accept Standard JSON Schema can't derive JSON Schema from Effect 3 schemas, even though JSONSchema.make already generates draft-07 and draft 2020-12 on 3.x. The ~standard object is built in standardSchemaV1:
The README says Effect 3 lives on the v3 branch and that Effect 3 issues and pull requests should target it, and that branch still receives fixes. It doesn't say whether new features are accepted there, so if 3.x only takes fixes, feel free to close this.
What is the feature you are proposing to solve the problem?
Add jsonSchema to the ~standard object returned by Schema.standardSchemaV1, mapping draft-07 to jsonSchema7 and draft-2020-12 to jsonSchema2020-12, and throwing for other targets as the spec asks. In userland:
import { JSONSchema, Schema } from "effect"
const targets = { "draft-07": "jsonSchema7", "draft-2020-12": "jsonSchema2020-12" }
const converter = (schema) => ({ target }) => {
if (!Object.hasOwn(targets, target)) {
throw new Error(`Unsupported target: ${target}`)
}
return JSONSchema.make(schema, { target: targets[target] })
}
const standardJSONSchemaV1 = (schema) => {
const standard = Schema.standardSchemaV1(schema)
standard["~standard"].jsonSchema = {
input: converter(Schema.encodedSchema(schema)),
output: converter(Schema.typeSchema(schema)),
}
return standard
}
const Note = Schema.Struct({ title: Schema.String, pinnedAt: Schema.NumberFromString })
const { jsonSchema } = standardJSONSchemaV1(Note)["~standard"]
console.log(JSON.stringify(jsonSchema.input({ target: "draft-2020-12" })))
console.log(JSON.stringify(jsonSchema.output({ target: "draft-07" })))
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","required":["title","pinnedAt"],"properties":{"title":{"type":"string"},"pinnedAt":{"type":"string","description":"a string to be decoded into a number"}},"additionalProperties":false}
{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["title","pinnedAt"],"properties":{"title":{"type":"string"},"pinnedAt":{"type":"number"}},"additionalProperties":false}
The StandardJSONSchemaV1 types arrived in @standard-schema/[email protected], while effect 3.x declares ^1.0.0, so the range would need a bump:
What alternatives have you considered?
- The userland wrapper above, which every project on 3.x would have to copy.
- Upgrading to Effect 4, the long-term path, which isn't always possible right away for an existing 3.x codebase.
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 11時間 24分
- マージ済み PR(30日)
- 848
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
AI providers: tool results cannot carry images because non-string results are JSON.stringify'd対応中かも @nmnmcc が今日担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
Effect-TS/effect#9857 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
`Schema.Literals`: add `omit`, the complement of `pick`対応中かも @effect-bot が今日担当しました。 オープンenhancement Needs Evaluation
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Support the `openapi-3.0` target in `Schema.toStandardJSONSchemaV1`対応中かも @MichaelDeBoey が 1 日前に担当しました。 オープンenhancement Needs Evaluation
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
Effect-TS/effect#9764 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
level/task type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
wazuh/wazuh-dashboard-plugins#9508 ·
メンテナーはふだん 1 日以内に返信
-
Testnet EOL page links Zonescan mainnet対応中かも @napelvs が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Azure-Samples/azure-search-openai-demo#3249 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] docs/architecture.mermaid leaves out 21 of the 51 src/ directories対応中かも @uyg7x が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
enhancement status:needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dongdongbh/Mindwtr#1438 ·
メンテナーはふだん 1 日以内に返信