external_ids accepts empty and whitespace keys that properties rejects
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python, typescript
- Ambito
- backend-api-design
Direzione di ricerca
Inizia da _require_str_mapping in src/selfgraph/_ops.py e requireStrMapping in typescript/src/validate.ts; confrontali con i validator di mapping JSON affini menzionati nell’issue. Controlla i test di validazione per entrambi gli SDK e aggiungi casi per le chiavi external_ids vuote e composte solo da spazi. Il lavoro è completato quando entrambi gli SDK rifiutano queste chiavi con lo stesso messaggio di properties.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
external_ids accepts an empty or whitespace-only key, while properties rejects the same key. The two sibling fields validate keys differently, in both SDKs.
Reproduction (0.2.2, Kuzu backend)
await g.entities.create("A", "Person", properties={"": 1})
# ValidationError: properties keys cannot be empty or whitespace
await g.entities.create("B", "Person", external_ids={"": "v"})
# stored; get() returns external_ids == {"": "v"}
await g.entities.create("C", "Person", external_ids={" ": "v"})
# also stored
A whitespace-only key behaves the same way. Control-character keys (NUL, newline, tab) are rejected for both fields; only the empty and whitespace case diverges.
Cause
properties goes through _require_json_mapping, which rejects empty or whitespace keys:
if any(not key.strip() for key in value):
raise ValidationError(f"{name} keys cannot be empty or whitespace")
external_ids goes through _require_str_mapping (src/selfgraph/_ops.py around line 464), which checks only that the values are strings and never checks the keys. The TypeScript port is identical: requireJsonMapping rejects blank keys but requireStrMapping does not (typescript/src/validate.ts around lines 384 and 399), so both SDKs share the gap.
This is the complement of #339 (which is about an empty property key rejecting a whole insert.text): there the empty key is rejected, here it is silently accepted. A single decision about empty keys could cover both.
Expected
external_ids keys are validated like properties keys, so an empty or whitespace-only key raises ValidationError with the same message, in both SDKs.
- Lingua principale
- TypeScript
- Stelle
- 173
- Fork
- 58
- Merge medio
- 6h
- PR unite (30g)
- 120
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 hydra-db/selfgraph
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
hydra-db/selfgraph#401 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: errors area: store bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
hydra-db/selfgraph#398 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: errors area: write bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
hydra-db/selfgraph#392 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
approved-for-pr area: cli-mcp area: parity bug effort: S P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
hydra-db/selfgraph#384 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di hydra-db/selfgraph
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
code-yeongyu/senpi#7139 ·
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 1-3 ore Idoneità per principianti 72/100
lingdojo/kana-dojo#34395 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mastra-ai/mastra#31093 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:web p2 product:business triage:active type:bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
cuadrao-ai/argus#2328 ·
I maintainer di solito rispondono entro 1 giorno
-
bug frontend good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
nikhilb2/simple_invoicing#907 ·