Server architecture for large schemas. Type extensions?
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fsprojects/FSharp.Data.GraphQL
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
fsprojects/FSharp.Data.GraphQL#573 · 1 reaction · 2 người được giao ·
-
FR: Suave package Đang mở
fsprojects/FSharp.Data.GraphQL#566 · 1 bình luận · 1 reaction · 2 người được giao ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
Tất cả issue của fsprojects/FSharp.Data.GraphQL
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Đang mởbug ecr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100