Schema: add typed set and map types (ReadonlySet / ReadonlyMap)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 57/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend-api-design
Direzione di ricerca
Start with ecs/packages/ecs/src/interface/schema/schema.ts, the existing reference implementation mentioned in the issue, then trace this repository’s Schema, schemaTypes, Schema.ToType, toTypeScript, validation, and createCoerceFunction entry points. Add typed set and map support across those areas and pin the inferred types with type tests. Done means values validate and coerce their typed elements, render as ReadonlySet<T> and ReadonlyMap<K, V>, and round-trip through Data.stringify and Data.parse.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Data includes ReadonlySet<Data> and ReadonlyMap<Data, Data>, and Data.stringify / Data.parse round-trip both, but Schema has no way to describe either with typed elements.
typeacceptsnumber | integer | string | boolean | null | array | object | typed-buffer | blob | observe | promise | generator | function. There's nosetormap.- The only escape hatch is
typeName:Schema.ToType<{ typeName: 'Set' }>isReadonlySet<any>, which loses the element type.toTypeScriptrenders it as a bareSet.{ typeName: 'ReadonlySet' }resolves toany, becauseReadonlySetisn't a runtime global. uniqueItemson an array doesn't map to a set either.
So a schema-described value that's naturally a set, such as an observable set of ids exposed to an agent, has to be modeled as an array.
Proposal
Port the set and map forms that @adobe/ecs already has (ecs/packages/ecs/src/interface/schema/schema.ts):
{ type: 'set', items: S } // ToType → ReadonlySet<ToType<S>>
{ type: 'map', keys: K, values: V } // ToType → ReadonlyMap<ToType<K>, ToType<V>>
Covering:
Schema/schemaTypes: addsetandmap.Schema.ToType: map them toReadonlySet/ReadonlyMapwith typed elements.toTypeScript: renderReadonlySet<T>/ReadonlyMap<K, V>.- Validation and
createCoerceFunction: check elements againstitems, andkeys/values. - Type-tests pinning
ToTypefor both, plus a round-trip test throughData.stringify/Data.parse.
Motivation
Firefly Platform's agentic surface types (Agentic.State<S> derives its value type from Schema.ToType<S>) need an Observe<ReadonlySet<AppId>> state. Until this lands it uses ReadonlyArray<AppId>.
- Lingua principale
- TypeScript
- Stelle
- 12
- Fork
- 8
- Merge medio
- 9h 2m
- PR unite (30g)
- 25
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 adobe/data
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
I maintainer di solito rispondono entro 1 giorno
-
ecs: let kernels issue commands through helpers (component lists, symbol-keyed values, void helpers)Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
-
createLazy: wrap nested service groups and accept partial (subset) schemasForse già presa @krisnye l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langchain-ai/langchainjs#12157 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
activescott/home-infra-k8s-flux#511 ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
lingdojo/kana-dojo#33753 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
android:player
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
follow-up needs-triage S3: minor
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
manaflow-ai/cmux#38032 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno