Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`fromJsonSchemaDocument`: intersect an object with `anyOf` branches that re-declare an enum property

Aperta
#10,047 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@effect-bot ci sta già lavorando.

Dal 28/10/2026.

  • #10070 di @effect-bot — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
tooling

Direzione di ricerca

Start at SchemaRepresentation.fromJsonSchemaDocument and trace where object schemas with sibling anyOf are converted; search the importer for the error text Cannot intersect these "anyOf" or "oneOf" alternatives without expanding their branches. Reproduce with the provided JsonSchema.fromSchemaDraft07 snippet, then inspect how branch properties and required are merged. Done when that object imports without the error, preserving the re-declared enum, with a regression test for the dependabot-style shape.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What is the problem this feature would solve?

On 4.0.7, an object schema with a sibling anyOf whose branches re-declare one of its properties fails when that property has an enum:

SchemaRepresentation.fromJsonSchemaDocument(JsonSchema.fromSchemaDraft07({
  type: "object",
  properties: { name: { type: "string" }, kind: { enum: ["direct", "all"] } },
  anyOf: [
    { properties: { name: { type: "string" } }, required: ["name"] },
    { properties: { kind: { enum: ["direct", "all"] } }, required: ["kind"] }
  ]
}))
// Cannot intersect these "anyOf" or "oneOf" alternatives without expanding their branches.

This is the shape of update.allow.items in dependabot-2.0.json: an entry must name a dependency, a dependency type, or both.

Context: validating .github/dependabot.yaml and GitHub workflow files with SchemaRepresentation.fromJsonSchemaDocument against the SchemaStore documents dependabot-2.0.json and github-workflow.json, to replace ajv. Since #7410 the importer rejects keywords it cannot represent, which is the right failure, but it means both real-world documents cannot be imported at all. This is one of five gaps found in those two documents; each is filed separately.

What is the feature you are proposing to solve the problem?

Intersect the object with each alternative branch by branch, producing a union of objects, at least when the branches only re-declare known properties and add required. Re-declaring a property with an identical schema could also be treated as a no-op before intersecting.

What alternatives have you considered?
  • Rewriting the vendored document by hand: possible, but it would no longer be the published contract.
  • Keeping ajv for these documents: what we do today.
Lingua principale
TypeScript
Stelle
16.7k
Fork
808
Merge medio
11h 11m
PR unite (30g)
840

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Effect-TS/effect

Tutte le issue di Effect-TS/effect

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.