You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture-decisions/0006-use-graphql-for-api.md
+47-8Lines changed: 47 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,53 @@ Supercedes [4. Use OpenAPI Specification](0004-use-openapi-specification.md)
12
12
13
13
The initial TIMDEX implementation chose a REST API. During development of new expanded features, we revisted this decision and looked at our options and needs.
14
14
15
-
### Options considered
16
-
17
-
|| GraphQL | OpenAPI spec REST API | JSON API |
18
-
|---|---|---|---|
19
-
| Description | GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. | The OpenAPI Specification is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services | JSON:API is a specification for how a client should request that resources be fetched or modified, and how a server should respond to those requests. JSON:API is designed to minimize both the number of requests and the amount of data transmitted between clients and servers. This efficiency is achieved without compromising readability, flexibility, or discoverability. |
20
-
| Pros | <ul><li>GraphiQL interactive editor allows users to explore the API without writing any code</li><li>Users can request the exact data they want as part of the query</li><li>Schema allows users and applications to import and understand data types</li></ul>| <ul><li>REST APIs are comfortable for many developers as they have used them before</li><li>uses OpenAPI spec and transitioning to V2 in OpenAPI would be familiar</li></ul> | <ul><li>Adds standardization to REST APIs</li></ul> |
21
-
| Neutral || <ul><li>v2 requires significant changes to v1 and is essentially a rewrite so any apps using v1 will need to make changes regardless of if we keep this similar spec</li><li>Auto generation of documentation is useful, but does not meet all of our documentation plans for v2</li></ul> |
22
-
| Cons | <ul><li>Requires developers to learn GraphQL syntax</li><li>More difficult to scale with simple caching</li></ul> | <ul><li>Requires many decisions to be made as to how to request data when designing the spec</li><li>The only way to know how to use the API will be to rely on our spec and our documentation. It will be a unique API</li></ul> | <ul><li>Unclear how well adopted it is</li></ul> |
15
+
### Options Considered
16
+
17
+
#### GraphQL
18
+
19
+
**Description:** GraphQL is a query language for APIs...
20
+
21
+
**Pros:**
22
+
23
+
- GraphiQL interactive editor allows users to explore the API without writing any code
24
+
- Users can request the exact data they want as part of the query
25
+
- Schema allows users and applications to import and understand data types
26
+
27
+
**Cons:**
28
+
29
+
- Requires developers to learn GraphQL syntax
30
+
- More difficult to scale with simple caching
31
+
32
+
#### OpenAPI spec REST API
33
+
34
+
**Description:** The OpenAPI Specification is a specification...
35
+
36
+
**Pros:**
37
+
38
+
- REST APIs are comfortable for many developers as they have used them before
39
+
- uses OpenAPI spec and transitioning to V2 in OpenAPI would be familiar
40
+
41
+
**Neutral:**
42
+
43
+
- v2 requires significant changes to v1 and is essentially a rewrite so any apps using v1 will need to make changes regardless of if we keep this similar spec
44
+
- Auto generation of documentation is useful, but does not meet all of our documentation plans for v2
45
+
46
+
**Cons:**
47
+
48
+
- Requires many decisions to be made as to how to request data when designing the spec
49
+
- The only way to know how to use the API will be to rely on our spec and our documentation
50
+
51
+
#### JSON API
52
+
53
+
**Description:** JSON:API is a specification for how a client should request that resources be fetched or modified, and how a server should respond to those requests. JSON:API is designed to minimize both the number of requests and the amount of data transmitted between clients and servers. This efficiency is achieved without compromising readability, flexibility, or discoverability.
0 commit comments