`fromJsonSchemaDocument`: intersect an object with `anyOf` branches that re-declare an enum property
I maintainer di solito rispondono entro 1 giorno
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
ajvfor 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
- 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à 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
@effect/ai-anthropic: text_editor_20250728 insert decodes `new_str`, but the API sends `insert_text`Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
[email protected]: crypto/KeyFormat declarations require the global JsonWebKey, breaking Node-only type-checksForse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#10115 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
sql-pg: send several statements in one extended-query Sync (transaction-local context without extra round trips)Forse già presa @effect-bot l’ha presa oggi. Aperta
Effect-TS/effect#10113 · 1 assegnatario ·
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 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
CopilotKit/openmuse#215 ·
I maintainer di solito rispondono entro 3 giorni
-
b:minor bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
software-mansion/argent#1698 ·
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
redhat-developer/rhdh-plugin-export-overlays#4624 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno