Schema: add typed set and map types (ReadonlySet / ReadonlyMap)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 57/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- backend-api-design
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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>.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 12
- Forks
- 8
- Ø Merge
- 9 Std. 2 Min.
- Gemergte PRs (30 T.)
- 25
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus adobe/data
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
Maintainer antworten meist innerhalb von 1 Tag
-
ecs: let kernels issue commands through helpers (component lists, symbol-keyed values, void helpers)Offen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 15/100
Maintainer antworten meist innerhalb von 1 Tag
-
createLazy: wrap nested service groups and accept partial (subset) schemasEvtl. vergeben @krisnye hat das vor 2 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 8/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
content triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
tensorflow/tfjs#8754 ·
-
tool-submission
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 83/100
BraveOPotato/NoSignups#2348 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
code-yeongyu/oh-my-openagent#12784 ·
Maintainer antworten meist innerhalb von 1 Tag
-
external-issue to-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 71/100
Maintainer antworten meist innerhalb von 1 Tag