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

Đang mở
#2,077 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
graphql, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
5
Fork
4
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
60

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của HarperFast/studio

Tất cả issue của HarperFast/studio

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.