Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GraphQL pagination to Decision Records #6080

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DEVELOPMENT_DECISION_RECORDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ Prefer immutable types over mutable. Use builders where appropriate. See
[Avoid using records if you cannot encapsulate it properly](doc/dev/decisionrecords/RecordsPOJOsBuilders.md#records)


## GraphQL Best Practices - API Design

[Follow best practices for designing GraphQL APIs. Our APIs are used by hundreds of clients
(web-pages/apps/services) and need to be backwards compatible.](doc/dev/A)
26 changes: 26 additions & 0 deletions doc/dev/decisionrecords/APIGraphQLDesign.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# GraphQL Best Practices - API Design

Follow best practices for designing GraphQL APIs. Our APIs are used by hundreds of clients
(web-pages/apps/services) and need to be backwards compatible. A good reference used by several
of the OTP developers are the Production Ready GraphQL book by Marc-André Giroux.


## Pagination

We use the [pagination](https://graphql.org/learn/pagination/) (a.k. Relay) specification for paging over entities like stations,
stops, trips and routes. Very often OTP has a _finite_ list of entities in memory. For non-entities
(Itinerary and Legs), witch do not always have an ID and is none trivial to reconstruct, it is
better to make a custom solution.


## Consistency

Unfortunately, part of the GraphQL API is old and does not follow best practices. So, when adding
new features, consider what is best; To follow the existing style or follow the best practice.


### Context and Problem Statement

Our APIs are used by hundreds of clients(web-pages/apps/services) and need to backwards compatible.
Correcting mistakes may not be possible or may take a long time.

2 changes: 0 additions & 2 deletions doc/dev/decisionrecords/_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
later.
-->

Original pull-request: {#NNNN}


### Context and Problem Statement

Expand Down
Loading