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

オープン
#2,077 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
graphql, typescript
領域
frontend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
5
フォーク
4
平均マージ
2日 13時間
マージ済み PR(30日)
60

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

HarperFast/studio のほかの issue

HarperFast/studio の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。