Schema editor: a comment line before a continued directive keeps the table as text

Aperta
#2,077 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
graphql, typescript
Ambito
frontend

Direzione di ricerca

Start in parseFields in src/features/instance/applications/lib/schema/parseSchema.ts, where a comment line between a field's type and its continued directive ends the field. Then check generateTable in serializeSchema.ts, which must emit the captured comment above the directive block. The regression test "a comment between a field and its continued directive" in serializeSchema.test.ts currently locks in the text fallback and will need updating. Done when the example table parses visually, the comment survives an edit and round-trip, and the test passes.

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

Descrizione

Problem

The visual schema editor can't edit a table when a # comment line sits between a field and the directive continued on the lines below it:

type Product @table(audit: true) {
	id: ID @primaryKey
	title: String
	catalogSearch: FullText
		# searches the title
		@fullText(fields: [{ name: "title" }])
}

The parser reads directives continued onto following lines (the layout Harper's docs use for @fullText), but a comment line in that gap ends the field. The table then stays raw text: nothing is lost, and "Edit as text" still works, but the visual editor doesn't offer it.

Why it was left

Carrying the comment through a regeneration needs a place in the field model for comments between a field's type and its continued directives. Without one, parsing past the comment would drop it on the next edit. Keeping the table as text is the safe behavior, and a regression test records it (serializeSchema.test.ts, "a comment between a field and its continued directive").

What would fix it

Capture comment lines between a field's type and its continued directives in parseFields (src/features/instance/applications/lib/schema/parseSchema.ts), and emit them above the directive block in generateTable (serializeSchema.ts).

Found in the pre-push review of the full-text work for #2014.

Review-Deferral: 5dc0829d5b20df5d severity=nit category=correctness

Lingua principale
TypeScript
Stelle
5
Fork
4
Merge medio
2g 13h
PR unite (30g)
60

Preparare l'ambiente

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 HarperFast/studio

Tutte le issue di HarperFast/studio

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.