Effect 3: add `~standard.jsonSchema` to `Schema.standardSchemaV1`
I maintainer di solito rispondono entro 1 giorno
@effect-bot ci sta già lavorando.
Dal 22/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 11h 24m
- PR unite (30g)
- 848
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Effect-TS/effect
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
AI providers: tool results cannot carry images because non-string results are JSON.stringify'dForse già presa @nmnmcc l’ha presa oggi. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Effect-TS/effect#9857 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
`Schema.Literals`: add `omit`, the complement of `pick`Forse già presa @effect-bot l’ha presa oggi. Apertaenhancement Needs Evaluation
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Support the `openapi-3.0` target in `Schema.toStandardJSONSchemaV1`Forse già presa @MichaelDeBoey l’ha presa 1 giorno fa. Apertaenhancement Needs Evaluation
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Effect-TS/effect#9764 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Nimblesite/SharpLsp#468 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Bundled uv is never updated and trusts the compromised eMudhra certificatesForse già presa @FabienDanieau l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bg_wait's blocking mode (stopOnAttention: false) is under-documented and effectively undiscoverableAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
nicobailon/pi-subagents#3019 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
db-ux-design-system/core-web#8613 ·
I maintainer di solito rispondono entro 1 giorno