graphprotocol / graphprotocol/graph-node

Stricter subgraph schema validation

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

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

bug validation
Ngôn ngữ chính
Rust
Star
3.2k
Fork
1.1k
Merge trung bình
4 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

We currently allow a lot of names in schemas that either cause problems or that we want to deliberately forbid in order to give us a reserved namespace. Examples are:

  • Entity fields called set and unset. AssemblyScript apparently allows things like

    entity.set = "foo"
    

    which will replace the set(key: string, value: Value) method in the Entity base class with a string, which breaks all later attempts to assign fields in the same handler.

  • Entity types and fields with a leading underscore (we have already introduced the special _Schema_ type and we want to move towards reserving names starting with underscores for Graph features.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Create a subgraph with a schema like this:

type Set @entity {
  id: ID!
}

type SetCreation @entity {
  id: ID!
  set: Set!
  name: String!
}

then write a handler that does the following:

let creation = new SetCreation("foo")
creation.set = "bar"
creation.name = "baz"

this will fail to compile.

What is the expected behavior?

We should catch problematic names at deploy (or even at codegen/build time) in graph-cli and graph-node.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Issue nêu graph-cli và graph-node là các điểm đầu vào để xác thực; hãy bắt đầu bằng cách lần theo nơi các schema của subgraph được kiểm tra trong quá trình deploy hoặc tạo mã. Tái hiện schema và handler được cung cấp, sau đó đảm bảo rằng các tên dành riêng như set, unset và tên entity hoặc field bắt đầu bằng dấu gạch dưới bị từ chối trước khi deploy hoặc build.

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

Đánh giá

Công nghệ
graphql, rust
Lĩnh vực
backend-api-design, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.