Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Server architecture for large schemas. Type extensions?

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
20/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
fsharp, graphql
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

Bắt đầu bằng cách xem xét bố cục được mô tả của User.fs, Organization.fs và Query.fs cùng với đặc tả GraphQL Object Extensions được liên kết trong issue. Xác định xem thư viện đã có điểm truy cập cho schema hoặc định nghĩa object phục vụ kiến trúc này hay chưa. Công việc được xem là hoàn tất khi có một khuyến nghị đã được thống nhất hoặc một kế hoạch triển khai được xác định phạm vi rõ ràng cho các trường quan hệ xuyên tệp và các phần mở rộng.

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

Mô tả

My team is migrating an existing GraphQL API from JS to F#. Our API has a lot of types, so we decided to create a file per type (Define.Object).

The file structure looks like this:

  • Schema
    • User.fs
    • Organization.fs
    • ...
    • Query.fs

If Organization has a users field that returns ListOf User, you can simply compile User.fs before Organization.fs.
However, this doesn't work if User also needs to have an organizations field, because F# doesn't allow mutual recursion across files.

What is the recommended way to architecture a big server like this? The samples use a single schema file, but unfortunately, that's just not feasible for our use case. If we did this, we would eventually have a file with 20K+ lines of code (judging by the size of our JS API).

A solution might be supporting Type Extensions. Especially, Object Extensions: http://spec.graphql.org/June2018/#sec-Object-Extensions

With Object Extensions, we would be able to define these relationship fields at the return type module instead. In my example, Organization.fs would add the organizations field to the User type, and User.fs would add the users field to the Organization type.

This architecture would work out pretty nicely for us because the querying and authorization logic needed to return records of a type would remain in its module as opposed to being spread across the codebase.

Supporting GraphQL extensions would also allow users of this library to build GraphQL microservices, that could be composed using tools like Apollo Federation.

If you think that's a good idea, I'd be more than happy to contribute. Thanks!

Ngôn ngữ chính
F#
Star
406
Fork
74
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
14

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

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 fsprojects/FSharp.Data.GraphQL

Tất cả issue của fsprojects/FSharp.Data.GraphQL

Issue tương tự

Thêm issue về Backend & API Design

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.